input+btcwallet: add MuSig2 signing operations

With this commit we add the high-level MuSig2 signing methods to the
btcwallet which will later be exposed through an RPC interface.
This commit is contained in:
Oliver Gugger
2022-04-27 22:20:33 +02:00
parent fee2b28d1b
commit 8fc99fba00
3 changed files with 493 additions and 7 deletions

View File

@@ -24,6 +24,7 @@ import (
"github.com/btcsuite/btcwallet/walletdb"
"github.com/btcsuite/btcwallet/wtxmgr"
"github.com/lightningnetwork/lnd/blockcache"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/keychain"
"github.com/lightningnetwork/lnd/kvdb"
"github.com/lightningnetwork/lnd/lnwallet"
@@ -98,6 +99,9 @@ type BtcWallet struct {
chainKeyScope waddrmgr.KeyScope
blockCache *blockcache.BlockCache
musig2Sessions map[input.MuSig2SessionID]*muSig2State
musig2SessionsMtx sync.Mutex
}
// A compile time check to ensure that BtcWallet implements the
@@ -160,13 +164,14 @@ func New(cfg Config, blockCache *blockcache.BlockCache) (*BtcWallet, error) {
}
return &BtcWallet{
cfg: &cfg,
wallet: wallet,
db: wallet.Database(),
chain: cfg.ChainSource,
netParams: cfg.NetParams,
chainKeyScope: chainKeyScope,
blockCache: blockCache,
cfg: &cfg,
wallet: wallet,
db: wallet.Database(),
chain: cfg.ChainSource,
netParams: cfg.NetParams,
chainKeyScope: chainKeyScope,
blockCache: blockCache,
musig2Sessions: make(map[input.MuSig2SessionID]*muSig2State),
}, nil
}