mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-19 05:45:21 +01:00
lnwallet/chanfunding: add optional tapscript root
This commit is contained in:
parent
2c56b3120a
commit
eeee2979e5
@ -58,6 +58,14 @@ type ShimIntent struct {
|
||||
// generate an aggregate key to use as the taproot-native multi-sig
|
||||
// output.
|
||||
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
|
||||
@ -79,7 +87,7 @@ func (s *ShimIntent) FundingOutput() ([]byte, *wire.TxOut, error) {
|
||||
// the keys are sorted before use.
|
||||
return input.GenTaprootFundingScript(
|
||||
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{
|
||||
localFundingAmt: p.fundingAmt,
|
||||
musig2: req.Musig2,
|
||||
tapscriptRoot: req.TapscriptRoot,
|
||||
},
|
||||
State: PsbtShimRegistered,
|
||||
BasePsbt: p.basePsbt,
|
||||
|
@ -394,7 +394,6 @@ func (w *WalletAssembler) ProvisionChannel(r *Request) (Intent, error) {
|
||||
// we will call the specialized coin selection function for
|
||||
// that.
|
||||
case r.FundUpToMaxAmt != 0 && r.MinFundAmt != 0:
|
||||
|
||||
// We need to ensure that manually selected coins, which
|
||||
// are spent entirely on the channel funding, leave
|
||||
// enough funds in the wallet to cover for a reserve.
|
||||
@ -539,6 +538,7 @@ func (w *WalletAssembler) ProvisionChannel(r *Request) (Intent, error) {
|
||||
localFundingAmt: localContributionAmt,
|
||||
remoteFundingAmt: r.RemoteAmt,
|
||||
musig2: r.Musig2,
|
||||
tapscriptRoot: r.TapscriptRoot,
|
||||
},
|
||||
InputCoins: selectedCoins,
|
||||
coinLeaser: w.cfg.CoinLeaser,
|
||||
|
Loading…
Reference in New Issue
Block a user