Commit 0dbc64f
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 b14bb14 commit 0dbc64f
File tree
3 files changed
+556
-61
lines changed- lightning/src/ln
3 files changed
+556
-61
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7772 | 7772 | | |
7773 | 7773 | | |
7774 | 7774 | | |
7775 | | - | |
7776 | | - | |
7777 | | - | |
7778 | | - | |
7779 | | - | |
| 7775 | + | |
| 7776 | + | |
| 7777 | + | |
| 7778 | + | |
| 7779 | + | |
| 7780 | + | |
7780 | 7781 | | |
7781 | 7782 | | |
7782 | | - | |
7783 | | - | |
7784 | | - | |
7785 | | - | |
7786 | | - | |
7787 | | - | |
7788 | | - | |
7789 | | - | |
7790 | | - | |
7791 | | - | |
7792 | | - | |
7793 | | - | |
7794 | | - | |
7795 | | - | |
7796 | | - | |
7797 | | - | |
7798 | | - | |
7799 | | - | |
7800 | | - | |
7801 | | - | |
7802 | | - | |
7803 | | - | |
7804 | | - | |
7805 | | - | |
7806 | | - | |
7807 | | - | |
| 7783 | + | |
| 7784 | + | |
| 7785 | + | |
| 7786 | + | |
| 7787 | + | |
| 7788 | + | |
7808 | 7789 | | |
7809 | 7790 | | |
7810 | 7791 | | |
7811 | 7792 | | |
7812 | | - | |
7813 | | - | |
| 7793 | + | |
| 7794 | + | |
| 7795 | + | |
| 7796 | + | |
| 7797 | + | |
| 7798 | + | |
| 7799 | + | |
| 7800 | + | |
7814 | 7801 | | |
7815 | 7802 | | |
7816 | 7803 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5901 | 5901 | | |
5902 | 5902 | | |
5903 | 5903 | | |
5904 | | - | |
5905 | | - | |
5906 | | - | |
5907 | | - | |
5908 | | - | |
5909 | | - | |
5910 | | - | |
| 5904 | + | |
| 5905 | + | |
| 5906 | + | |
| 5907 | + | |
| 5908 | + | |
| 5909 | + | |
| 5910 | + | |
| 5911 | + | |
| 5912 | + | |
| 5913 | + | |
| 5914 | + | |
| 5915 | + | |
| 5916 | + | |
| 5917 | + | |
| 5918 | + | |
| 5919 | + | |
| 5920 | + | |
| 5921 | + | |
| 5922 | + | |
| 5923 | + | |
5911 | 5924 | | |
5912 | 5925 | | |
5913 | 5926 | | |
5914 | 5927 | | |
5915 | 5928 | | |
5916 | | - | |
| 5929 | + | |
5917 | 5930 | | |
5918 | 5931 | | |
5919 | 5932 | | |
| |||
5943 | 5956 | | |
5944 | 5957 | | |
5945 | 5958 | | |
5946 | | - | |
5947 | | - | |
5948 | | - | |
| 5959 | + | |
5949 | 5960 | | |
5950 | 5961 | | |
5951 | 5962 | | |
| |||
0 commit comments