remove unused GetDestinationForKey
It is only used in test. There it is problematic, because it sometimes
relies on m_default_address_type. If the default were changed to
BECH32M, those tests would fail the assert(false).
So just use PKHash{} in all tests and remove GetDestinationForKey.
This commit is contained in:
6 files changed
+7
-36
No files matched your search
@@ -84,13 +84,11 @@ void TestAddAddressesToSendBook(interfaces::Node& node)
|
||||
wallet->SetupDescriptorScriptPubKeyMans();
|
||||
}
|
||||
|
||||
auto build_address = [&wallet]() {
|
||||
auto build_address{[]() {
|
||||
CKey key = GenerateRandomKey();
|
||||
CTxDestination dest(GetDestinationForKey(
|
||||
key.GetPubKey(), wallet->m_default_address_type));
|
||||
|
||||
const PKHash dest{key.GetPubKey()};
|
||||
return std::make_pair(dest, QString::fromStdString(EncodeDestination(dest)));
|
||||
};
|
||||
}};
|
||||
|
||||
CTxDestination r_key_dest, s_key_dest;
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ std::shared_ptr<CWallet> SetupDescriptorsWallet(interfaces::Node& node, TestChai
|
||||
WalletDescriptor w_desc(std::move(desc), 0, 0, 1, 1);
|
||||
auto spk_manager = *Assert(wallet->AddWalletDescriptor(w_desc, provider, "", false));
|
||||
assert(spk_manager);
|
||||
CTxDestination dest = GetDestinationForKey(test.coinbaseKey.GetPubKey(), wallet->m_default_address_type);
|
||||
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()));
|
||||
SyncUpWallet(wallet, node);
|
||||
@@ -406,7 +406,7 @@ void TestGUIWatchOnly(interfaces::Node& node, TestChain100Setup& test)
|
||||
sendCoinsDialog.findChild<QLabel*>("labelBalance"));
|
||||
|
||||
// Set change address
|
||||
sendCoinsDialog.getCoinControl()->destChange = GetDestinationForKey(test.coinbaseKey.GetPubKey(), OutputType::LEGACY);
|
||||
sendCoinsDialog.getCoinControl()->destChange = PKHash{test.coinbaseKey.GetPubKey()};
|
||||
|
||||
// Time to reject "save" PSBT dialog ('SendCoins' locks the main thread until the dialog receives the event).
|
||||
QTimer timer;
|
||||
|
||||
Reference in new issue
Block a user