multi: move all channelstate operations to ChannelStateDB
This commit is contained in:
1 parent
ddea833d31
commit
11cf4216e4
35 files changed
+377
-238
No files matched your search
+1
-1
@@ -18,7 +18,7 @@ type Config struct {
|
||||
// Database is a wrapper around a namespace within boltdb reserved for
|
||||
// ln-based wallet metadata. See the 'channeldb' package for further
|
||||
// information.
|
||||
Database *channeldb.DB
|
||||
Database *channeldb.ChannelStateDB
|
||||
|
||||
// Notifier is used by in order to obtain notifications about funding
|
||||
// transaction reaching a specified confirmation depth, and to catch
|
||||
|
||||
@@ -327,13 +327,13 @@ func createTestWallet(tempTestDir string, miningNode *rpctest.Harness,
|
||||
signer input.Signer, bio lnwallet.BlockChainIO) (*lnwallet.LightningWallet, error) {
|
||||
|
||||
dbDir := filepath.Join(tempTestDir, "cdb")
|
||||
cdb, err := channeldb.Open(dbDir)
|
||||
fullDB, err := channeldb.Open(dbDir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cfg := lnwallet.Config{
|
||||
Database: cdb,
|
||||
Database: fullDB.ChannelStateDB(),
|
||||
Notifier: notifier,
|
||||
SecretKeyRing: keyRing,
|
||||
WalletController: wc,
|
||||
@@ -2944,11 +2944,11 @@ func clearWalletStates(a, b *lnwallet.LightningWallet) error {
|
||||
a.ResetReservations()
|
||||
b.ResetReservations()
|
||||
|
||||
if err := a.Cfg.Database.Wipe(); err != nil {
|
||||
if err := a.Cfg.Database.GetParentDB().Wipe(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return b.Cfg.Database.Wipe()
|
||||
return b.Cfg.Database.GetParentDB().Wipe()
|
||||
}
|
||||
|
||||
func waitForMempoolTx(r *rpctest.Harness, txid *chainhash.Hash) error {
|
||||
|
||||
@@ -322,7 +322,7 @@ func CreateTestChannels(chanType channeldb.ChannelType) (
|
||||
RevocationStore: shachain.NewRevocationStore(),
|
||||
LocalCommitment: aliceLocalCommit,
|
||||
RemoteCommitment: aliceRemoteCommit,
|
||||
Db: dbAlice,
|
||||
Db: dbAlice.ChannelStateDB(),
|
||||
Packager: channeldb.NewChannelPackager(shortChanID),
|
||||
FundingTxn: testTx,
|
||||
}
|
||||
@@ -340,7 +340,7 @@ func CreateTestChannels(chanType channeldb.ChannelType) (
|
||||
RevocationStore: shachain.NewRevocationStore(),
|
||||
LocalCommitment: bobLocalCommit,
|
||||
RemoteCommitment: bobRemoteCommit,
|
||||
Db: dbBob,
|
||||
Db: dbBob.ChannelStateDB(),
|
||||
Packager: channeldb.NewChannelPackager(shortChanID),
|
||||
}
|
||||
|
||||
|
||||
@@ -937,7 +937,7 @@ func createTestChannelsForVectors(tc *testContext, chanType channeldb.ChannelTyp
|
||||
RevocationStore: shachain.NewRevocationStore(),
|
||||
LocalCommitment: remoteCommit,
|
||||
RemoteCommitment: remoteCommit,
|
||||
Db: dbRemote,
|
||||
Db: dbRemote.ChannelStateDB(),
|
||||
Packager: channeldb.NewChannelPackager(shortChanID),
|
||||
FundingTxn: tc.fundingTx.MsgTx(),
|
||||
}
|
||||
@@ -955,7 +955,7 @@ func createTestChannelsForVectors(tc *testContext, chanType channeldb.ChannelTyp
|
||||
RevocationStore: shachain.NewRevocationStore(),
|
||||
LocalCommitment: localCommit,
|
||||
RemoteCommitment: localCommit,
|
||||
Db: dbLocal,
|
||||
Db: dbLocal.ChannelStateDB(),
|
||||
Packager: channeldb.NewChannelPackager(shortChanID),
|
||||
FundingTxn: tc.fundingTx.MsgTx(),
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user