mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-27 20:39:56 +02:00
lnwallet/chanfunding: add optional tapscript root
This commit is contained in:
committed by
Oliver Gugger
parent
1e71b1e544
commit
9fd8287c7b
@@ -58,6 +58,14 @@ type ShimIntent struct {
|
|||||||
// generate an aggregate key to use as the taproot-native multi-sig
|
// generate an aggregate key to use as the taproot-native multi-sig
|
||||||
// output.
|
// output.
|
||||||
musig2 bool
|
musig2 bool
|
||||||
|
|
||||||
|
// tapscriptRoot is the root of the tapscript tree that will be used to
|
||||||
|
// create the funding output. This field will only be utilized if the
|
||||||
|
// MuSig2 flag above is set to true.
|
||||||
|
//
|
||||||
|
// TODO(roasbeef): fold above into new chan type? sum type like thing,
|
||||||
|
// includes the tapscript root, etc
|
||||||
|
tapscriptRoot fn.Option[chainhash.Hash]
|
||||||
}
|
}
|
||||||
|
|
||||||
// FundingOutput returns the witness script, and the output that creates the
|
// FundingOutput returns the witness script, and the output that creates the
|
||||||
@@ -79,7 +87,7 @@ func (s *ShimIntent) FundingOutput() ([]byte, *wire.TxOut, error) {
|
|||||||
// the keys are sorted before use.
|
// the keys are sorted before use.
|
||||||
return input.GenTaprootFundingScript(
|
return input.GenTaprootFundingScript(
|
||||||
s.localKey.PubKey, s.remoteKey, int64(totalAmt),
|
s.localKey.PubKey, s.remoteKey, int64(totalAmt),
|
||||||
fn.None[chainhash.Hash](),
|
s.tapscriptRoot,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -534,6 +534,7 @@ func (p *PsbtAssembler) ProvisionChannel(req *Request) (Intent, error) {
|
|||||||
ShimIntent: ShimIntent{
|
ShimIntent: ShimIntent{
|
||||||
localFundingAmt: p.fundingAmt,
|
localFundingAmt: p.fundingAmt,
|
||||||
musig2: req.Musig2,
|
musig2: req.Musig2,
|
||||||
|
tapscriptRoot: req.TapscriptRoot,
|
||||||
},
|
},
|
||||||
State: PsbtShimRegistered,
|
State: PsbtShimRegistered,
|
||||||
BasePsbt: p.basePsbt,
|
BasePsbt: p.basePsbt,
|
||||||
|
@@ -394,7 +394,6 @@ func (w *WalletAssembler) ProvisionChannel(r *Request) (Intent, error) {
|
|||||||
// we will call the specialized coin selection function for
|
// we will call the specialized coin selection function for
|
||||||
// that.
|
// that.
|
||||||
case r.FundUpToMaxAmt != 0 && r.MinFundAmt != 0:
|
case r.FundUpToMaxAmt != 0 && r.MinFundAmt != 0:
|
||||||
|
|
||||||
// We need to ensure that manually selected coins, which
|
// We need to ensure that manually selected coins, which
|
||||||
// are spent entirely on the channel funding, leave
|
// are spent entirely on the channel funding, leave
|
||||||
// enough funds in the wallet to cover for a reserve.
|
// enough funds in the wallet to cover for a reserve.
|
||||||
@@ -539,6 +538,7 @@ func (w *WalletAssembler) ProvisionChannel(r *Request) (Intent, error) {
|
|||||||
localFundingAmt: localContributionAmt,
|
localFundingAmt: localContributionAmt,
|
||||||
remoteFundingAmt: r.RemoteAmt,
|
remoteFundingAmt: r.RemoteAmt,
|
||||||
musig2: r.Musig2,
|
musig2: r.Musig2,
|
||||||
|
tapscriptRoot: r.TapscriptRoot,
|
||||||
},
|
},
|
||||||
InputCoins: selectedCoins,
|
InputCoins: selectedCoins,
|
||||||
coinLeaser: w.cfg.CoinLeaser,
|
coinLeaser: w.cfg.CoinLeaser,
|
||||||
|
Reference in New Issue
Block a user