Commit 9cd4091
committed
Verify the holder provided valid witnesses and uses SIGHASH_ALL
LDK checks the following:
* Each input spends an output that is one of P2WPKH, P2WSH, or P2TR.
These were already checked by LDK when the inputs to be contributed
were provided.
* All signatures use the `SIGHASH_ALL` sighash type.
* P2WPKH and P2TR key path spends are valid (verifies signatures)
NOTE:
* When checking P2WSH spends, LDK tries to decode 70-72 byte witness
elements as ECDSA signatures with a sighash flag. If the internal
DER-decoding fails, then LDK just assumes it wasn't a signature and
carries with checks. If the element can be decoded as an ECDSA
signature, the the sighash flag must be `SIGHASH_ALL`.
* When checking P2TR script-path spends, LDK assumes all elements of
exactly 65 bytes with the last byte matching any valid sighash flag
byte are schnorr signatures and checks that the sighash type is
`SIGHASH_ALL`. If the last byte is not any valid sighash flag, the
element is assumed not to be a signature and is ignored. Elements of
64 bytes are not checked because if they were schnorr signatures then
they would implicitly be `SIGHASH_DEFAULT` which is an alias of
`SIGHASH_ALL`.1 parent c2b293c commit 9cd4091
File tree
3 files changed
+537
-27
lines changed- lightning/src/ln
3 files changed
+537
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7991 | 7991 | | |
7992 | 7992 | | |
7993 | 7993 | | |
7994 | | - | |
| 7994 | + | |
| 7995 | + | |
| 7996 | + | |
| 7997 | + | |
| 7998 | + | |
7995 | 7999 | | |
7996 | 8000 | | |
7997 | 8001 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5933 | 5933 | | |
5934 | 5934 | | |
5935 | 5935 | | |
5936 | | - | |
5937 | | - | |
5938 | | - | |
5939 | | - | |
5940 | | - | |
5941 | | - | |
5942 | | - | |
| 5936 | + | |
| 5937 | + | |
| 5938 | + | |
| 5939 | + | |
| 5940 | + | |
| 5941 | + | |
| 5942 | + | |
| 5943 | + | |
| 5944 | + | |
| 5945 | + | |
| 5946 | + | |
| 5947 | + | |
| 5948 | + | |
| 5949 | + | |
| 5950 | + | |
| 5951 | + | |
| 5952 | + | |
| 5953 | + | |
| 5954 | + | |
| 5955 | + | |
5943 | 5956 | | |
5944 | 5957 | | |
5945 | 5958 | | |
5946 | 5959 | | |
5947 | 5960 | | |
5948 | | - | |
| 5961 | + | |
5949 | 5962 | | |
5950 | 5963 | | |
5951 | 5964 | | |
| |||
0 commit comments