wallet: Use util::Error throughout AddWalletDescriptor
32023 changed AddWalletDescriptor to return util::Error, but did not change all of the failure cases to do so. This may result in some callers continuing when there was actually an error. Unify all of the failure cases to use util::Error so that all callers handle AddWalletDescriptor errors in the same way. The encapsulated return type is changed from ScriptPubKeyMan* to std::reference_wrapper<DescriptorScriptPubKeyMan>. This avoids having a value that can be interpreted as a bool, and also removes the need to constantly dynamic_cast the returned value. The only kind of ScriptPubKeyMan that can come out of AddWalletDescriptor is a DescriptorScriptPubKeyMan anyways.
This commit is contained in:
1 parent
c461d15287
commit
785e1407b0
13 files changed
+28
-44
No files matched your search
@@ -215,8 +215,7 @@ std::shared_ptr<CWallet> SetupDescriptorsWallet(interfaces::Node& node, TestChai
|
||||
assert(descs.size() == 1);
|
||||
auto& desc = descs.at(0);
|
||||
WalletDescriptor w_desc(std::move(desc), 0, 0, 1, 1);
|
||||
auto spk_manager = *Assert(wallet->AddWalletDescriptor(w_desc, provider, "", false));
|
||||
assert(spk_manager);
|
||||
Assert(wallet->AddWalletDescriptor(w_desc, provider, "", false));
|
||||
const PKHash dest{test.coinbaseKey.GetPubKey()};
|
||||
wallet->SetAddressBook(dest, "", wallet::AddressPurpose::RECEIVE);
|
||||
wallet->SetLastBlockProcessed(105, WITH_LOCK(node.context()->chainman->GetMutex(), return node.context()->chainman->ActiveChain().Tip()->GetBlockHash()));
|
||||
|
||||
Reference in new issue
Block a user