Commit Graph
28 Commits
Author SHA1 Message Date
Olaoluwa Osuntokun 164b60675b input: add spending funcs for taproot sender HTLCs 2023-08-22 16:30:07 -07:00
Olaoluwa Osuntokun 7e7de11cfd input: add tapscript utils for the sender HTLC script
Unlike the old HTLC scripts, we now need to handle the various control
block interactions. As is, we opt to simply re-compute the entire tree
when needed, as the tree only has two leaves.
2023-08-22 16:30:05 -07:00
Olaoluwa Osuntokun 734dc0f085 input: add TaprootOutputKeyAnchor for taproot anchor outputs 2023-08-22 16:30:02 -07:00
Olaoluwa Osuntokun 50bf3b6177 input: add TaprootCommitScriptToRemote for taproot to remote script 2023-08-22 16:30:00 -07:00
Olaoluwa Osuntokun 5f81919284 input: add TaprootCommitScriptToSelf for taproot to self script 2023-08-22 16:29:57 -07:00
Olaoluwa Osuntokun 9d0c04bfa2 input: add GenTaprootFundingScript based on musig2
In this commit, we add GenTaprootFundingScript, which'll return the
taproot pkScript and output for a taproot+musig2 channel. This uses
musig2 key aggregation with sorting activated.

The final key produced uses a bip86 tweak, meaning that the output key
provably doesn't commit to any script path. In the future, we may want
to permit this, as then it allows for a greater degree of
programmability of the funding output.
2023-08-22 16:29:55 -07:00
Oliver Gugger 79c275253c input: set initial script allocation size
The default allocation of 500 bytes for the script that is
used in NewScriptBuilder is way too much for most of our scripts.
With the new functional option we can tune the allocation to exactly
what we need.
2023-04-11 11:15:36 +02:00
yyforyongyu 0735522194 multi: fix make fmt 2022-08-23 22:10:24 +08:00
Oliver Gugger 9f4f0e94f5 multi: avoid direct use of dcrec/secp256k1 library
Because the original dcrec secp256k1 library that is used for the
Schnorr signature primitives uses different hash algorithms than the
btcd secp256k1 library. Therefore pulling in the wrong library can lead
to weird and unexpected errors. We try to make it harder to make the
mistake by not using the library directly in lnd in the first place.
Note that it is still indirectly needed by the btcd secp256k1 library,
therefore the module dependency is still expected to be there, just
moved to the indirect section.
2022-05-11 10:07:52 +02:00
Oliver Gugger 72c9582b85 multi: bump btcd to taproot aware version 2022-03-24 15:00:25 +01:00
Oliver Gugger 7dfe4018ce multi: use btcd's btcec/v2 and btcutil modules
This commit was previously split into the following parts to ease
review:
 - 2d746f68: replace imports
 - 4008f0fd: use ecdsa.Signature
 - 849e33d1: remove btcec.S256()
 - b8f6ebbd: use v2 library correctly
 - fa80bca9: bump go modules
2022-03-09 19:02:37 +01:00
Oliver Gugger 895a2e497b multi: formatting and comment fixes 2022-02-10 11:02:02 +01:00
Oliver Gugger dfdc2bff8b multi: run gosimports 2022-02-10 11:02:01 +01:00
Dimitris Apostolou 530a2059e5 multi: Fix typos [skip ci] 2022-01-24 12:19:02 +02:00
Wilmer Paulino b84307e62e input: add scripts for new script enforced lease commitment type
The new commitment type consists of adding an additional CLTV
requirement to guarantee a leased channel's expiration on any commitment
and HTLC outputs that pay directly to the channel initiator.
2021-10-19 18:30:24 -07:00
eugene fdcd726f9a multi: replace DefaultDustLimit with script-specific DustLimitForSize
This commit updates call-sites to use the proper dust limits for
various script types. This also updates the default dust limit used
in the funding flow to be 354 satoshis instead of 573 satoshis.
2021-09-29 13:33:10 -04:00
Johan T. Halseth 0a0b5f89c9 input: create IsHtlcSpendRevoke 2021-05-12 12:32:29 +02:00
Andras Banki-Horvath 556e3525ea misc: fix error formatting in multiple files 2020-04-24 19:15:08 +02:00
Conner Fromknecht f2b6e2af04 input: pass input.Signature to multisig spend
Modifies SpendMultiSig to accept input.Signature, so that we can
ultimately assert the size of multisig witnesses.
2020-04-10 14:27:35 -07:00
Conner Fromknecht 0f94b8dc62 multi: return input.Signature from SignOutputRaw 2020-04-10 14:27:35 -07:00
Conner Fromknecht 37dffb225a input: introduce Signature iface
This commit introduces the Signature interface which will be used by our
witness construction methods instead of passing in raw byte slices. This
will be used later to inject various kinds of mock signatures, e.g.
73-byte signatures for simulating worst-case witness weight.
2020-04-09 12:49:11 -07:00
Johan T. Halseth bddd3e128c lnwallet: make second level sigs using sighash single|anyonecanpay 2020-03-09 12:59:33 +01:00
Johan T. Halseth 50199aeaf3 input/script_utils: add anchor scripts + tests 2020-03-09 12:10:59 +01:00
Johan T. Halseth 990992ce94 input/script_utils: add delayed to_remote script + tests 2020-03-09 12:10:59 +01:00
Johan T. Halseth 8c0deb81c2 input+lnwallet: Add scripts for CSV delayed HTLC outputs
We also increase the witness size for these types to account for the 3
extra bytes. The size won't be correct in all cases, but it is just an
upper bound in any case.
2020-03-09 12:10:58 +01:00
Olaoluwa Osuntokun bee777ab5f input: update CommitSpendNoDelay to be aware of tweakless commits, add new witness type
In this commit, we update the `CommitSpendNoDelay` method to be aware of
the alternate spending mechanism for commitments that don't have a tweak
for the remote party's non-delay output. We also add a new witness type
so callers can convey their expected signing path.
2019-09-25 18:25:37 -07:00
AdamISZ 6e054886d8 Typo corrections in various comments 2019-05-10 17:15:54 +02:00
Joost Jager 9e012ecc93 multi: move Input interface and related code
This commit is a step to split the lnwallet package. It puts the Input
interface and implementations in a separate package along with all their
dependencies from lnwallet.
2019-01-31 13:25:33 +01:00