multi: add new tapscript root option to GenTaprootFundingScript
This'll allow us to create a funding output that uses musig2, but uses a tapscript tweak rather than a normal BIP 86 tweak.
This commit is contained in:
1 parent
edf959d39f
commit
2c56b3120a
8 files changed
+36
-16
No files matched your search
@@ -5,7 +5,9 @@ import (
|
||||
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
)
|
||||
@@ -76,9 +78,8 @@ func (s *ShimIntent) FundingOutput() ([]byte, *wire.TxOut, error) {
|
||||
// Similar to the existing p2wsh script, we'll always ensure
|
||||
// the keys are sorted before use.
|
||||
return input.GenTaprootFundingScript(
|
||||
s.localKey.PubKey,
|
||||
s.remoteKey,
|
||||
int64(totalAmt),
|
||||
s.localKey.PubKey, s.remoteKey, int64(totalAmt),
|
||||
fn.None[chainhash.Hash](),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1013,6 +1013,7 @@ func (lc *LightningChannel) createSignDesc() error {
|
||||
if chanState.ChanType.IsTaproot() {
|
||||
fundingPkScript, _, err = input.GenTaprootFundingScript(
|
||||
localKey, remoteKey, int64(lc.channelState.Capacity),
|
||||
fn.None[chainhash.Hash](),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
+8
-2
@@ -23,6 +23,7 @@ import (
|
||||
"github.com/btcsuite/btcwallet/wallet"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
@@ -2102,6 +2103,7 @@ func (l *LightningWallet) verifyCommitSig(res *ChannelReservation,
|
||||
if res.musigSessions == nil {
|
||||
_, fundingOutput, err := input.GenTaprootFundingScript(
|
||||
localKey, remoteKey, channelValue,
|
||||
fn.None[chainhash.Hash](),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -2341,11 +2343,14 @@ func (l *LightningWallet) handleSingleFunderSigs(req *addSingleFunderSigsMsg) {
|
||||
fundingTxOut *wire.TxOut
|
||||
)
|
||||
if chanType.IsTaproot() {
|
||||
fundingWitnessScript, fundingTxOut, err = input.GenTaprootFundingScript( //nolint:lll
|
||||
//nolint:lll
|
||||
fundingWitnessScript, fundingTxOut, err = input.GenTaprootFundingScript(
|
||||
ourKey.PubKey, theirKey.PubKey, channelValue,
|
||||
fn.None[chainhash.Hash](),
|
||||
)
|
||||
} else {
|
||||
fundingWitnessScript, fundingTxOut, err = input.GenFundingPkScript( //nolint:lll
|
||||
//nolint:lll
|
||||
fundingWitnessScript, fundingTxOut, err = input.GenFundingPkScript(
|
||||
ourKey.PubKey.SerializeCompressed(),
|
||||
theirKey.PubKey.SerializeCompressed(), channelValue,
|
||||
)
|
||||
@@ -2482,6 +2487,7 @@ func (l *LightningWallet) ValidateChannel(channelState *channeldb.OpenChannel,
|
||||
if channelState.ChanType.IsTaproot() {
|
||||
fundingScript, _, err = input.GenTaprootFundingScript(
|
||||
localKey, remoteKey, int64(channel.Capacity),
|
||||
fn.None[chainhash.Hash](),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user