mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-05 17:05:50 +02:00
input+wallet: extract musig2 session management into new module
In this commit, we extract the musig2 session management into a new module. This allows us to re-use the session logic elsewhere in unit tests so we don't need to instantiate the entire wallet.
This commit is contained in:
@@ -104,8 +104,7 @@ type BtcWallet struct {
|
||||
|
||||
blockCache *blockcache.BlockCache
|
||||
|
||||
musig2Sessions map[input.MuSig2SessionID]*muSig2State
|
||||
musig2SessionsMtx sync.Mutex
|
||||
*input.MusigSessionManager
|
||||
}
|
||||
|
||||
// A compile time check to ensure that BtcWallet implements the
|
||||
@@ -167,16 +166,21 @@ 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,
|
||||
musig2Sessions: make(map[input.MuSig2SessionID]*muSig2State),
|
||||
}, nil
|
||||
finalWallet := &BtcWallet{
|
||||
cfg: &cfg,
|
||||
wallet: wallet,
|
||||
db: wallet.Database(),
|
||||
chain: cfg.ChainSource,
|
||||
netParams: cfg.NetParams,
|
||||
chainKeyScope: chainKeyScope,
|
||||
blockCache: blockCache,
|
||||
}
|
||||
|
||||
finalWallet.MusigSessionManager = input.NewMusigSessionManager(
|
||||
finalWallet.fetchPrivKey,
|
||||
)
|
||||
|
||||
return finalWallet, nil
|
||||
}
|
||||
|
||||
// loaderCfg holds optional wallet loader configuration.
|
||||
|
Reference in New Issue
Block a user