mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-08 14:57:38 +02:00
input+lnwallet: update taproot scripts to accept optional aux leaf
In this commit, we update all the taproot scripts to also accept an optional aux leaf. This aux leaf can be used to add more redemption paths for advanced channels, or just as an extra commitment space.
This commit is contained in:
committed by
Oliver Gugger
parent
8588c9bfd7
commit
1aae47fd71
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
secp "github.com/decred/dcrd/dcrec/secp256k1/v4"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
@@ -307,9 +308,11 @@ func newTaprootJusticeKit(sweepScript []byte,
|
||||
|
||||
keyRing := breachInfo.KeyRing
|
||||
|
||||
// TODO(roasbeef): aux leaf tower updates needed
|
||||
|
||||
tree, err := input.NewLocalCommitScriptTree(
|
||||
breachInfo.RemoteDelay, keyRing.ToLocalKey,
|
||||
keyRing.RevocationKey,
|
||||
keyRing.RevocationKey, fn.None[txscript.TapLeaf](),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -416,7 +419,9 @@ func (t *taprootJusticeKit) ToRemoteOutputSpendInfo() (*txscript.PkScript,
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
|
||||
scriptTree, err := input.NewRemoteCommitScriptTree(toRemotePk)
|
||||
scriptTree, err := input.NewRemoteCommitScriptTree(
|
||||
toRemotePk, fn.None[txscript.TapLeaf](),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/btcsuite/btcd/btcec/v2/schnorr"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
@@ -304,7 +305,9 @@ func TestJusticeKitRemoteWitnessConstruction(t *testing.T) {
|
||||
name: "taproot commitment",
|
||||
blobType: TypeAltruistTaprootCommit,
|
||||
expWitnessScript: func(pk *btcec.PublicKey) []byte {
|
||||
tree, _ := input.NewRemoteCommitScriptTree(pk)
|
||||
tree, _ := input.NewRemoteCommitScriptTree(
|
||||
pk, fn.None[txscript.TapLeaf](),
|
||||
)
|
||||
|
||||
return tree.SettleLeaf.Script
|
||||
},
|
||||
@@ -461,6 +464,7 @@ func TestJusticeKitToLocalWitnessConstruction(t *testing.T) {
|
||||
|
||||
script, _ := input.NewLocalCommitScriptTree(
|
||||
csvDelay, delay, rev,
|
||||
fn.None[txscript.TapLeaf](),
|
||||
)
|
||||
|
||||
return script.RevocationLeaf.Script
|
||||
|
Reference in New Issue
Block a user