Merge bitcoin/bitcoin#20773: refactor: split CWallet::Create
489ebb7b34wallet: make chain optional for CWallet::Create (Ivan Metlushko)d73ae93964CWallet::Create move chain init message up into calling code (Ivan Metlushko)44c430ffacrefactor: Add CWallet:::AttachChain method (Russell Yanofsky)e2a47ce085refactor: move first run detection to client code (Ivan Metlushko) Pull request description: This is a followup for https://github.com/bitcoin/bitcoin/pull/20365#discussion_r522265003 First part of a refactoring with overall goal to simplify `CWallet` and de-duplicate code with `wallettool` **Rationale**: split `CWallet::Create` and create `CWallet::AttachChain`. `CWallet::AttachChain` takes chain as first parameter on purpose. In future I suggest we can remove `chain` from `CWallet` constructor. The second commit is based on be164f9cf89b123f03b926aa980996919924ee64 from #15719 (thanks ryanofsky) cc ryanofsky achow101 ACKs for top commit: ryanofsky: Code review ACK489ebb7b34. Only changes since last review were adding a const variable declaration, and implementing suggestion not to move feerate option checks to AttachChain. Thanks for updates and fast responses! Tree-SHA512: 00235abfe1b00874c56c449adcab8a36582424abb9ba27440bf750af8f3f217b68c11ca74eb30f78a2109ad1d9009315480effc78345e16a3074a1b5d8128721
This commit is contained in:
11 files changed
+93
-68
No files matched your search
@@ -63,8 +63,7 @@ void TestAddAddressesToSendBook(interfaces::Node& node)
|
||||
node.setContext(&test.m_node);
|
||||
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), "", CreateMockWalletDatabase());
|
||||
wallet->SetupLegacyScriptPubKeyMan();
|
||||
bool firstRun;
|
||||
wallet->LoadWallet(firstRun);
|
||||
wallet->LoadWallet();
|
||||
|
||||
auto build_address = [&wallet]() {
|
||||
CKey key;
|
||||
|
||||
@@ -140,8 +140,7 @@ void TestGUI(interfaces::Node& node)
|
||||
}
|
||||
node.setContext(&test.m_node);
|
||||
std::shared_ptr<CWallet> wallet = std::make_shared<CWallet>(node.context()->chain.get(), "", CreateMockWalletDatabase());
|
||||
bool firstRun;
|
||||
wallet->LoadWallet(firstRun);
|
||||
wallet->LoadWallet();
|
||||
{
|
||||
auto spk_man = wallet->GetOrCreateLegacyScriptPubKeyMan();
|
||||
LOCK2(wallet->cs_wallet, spk_man->cs_KeyStore);
|
||||
|
||||
Reference in new issue
Block a user