Changeset View
Changeset View
Standalone View
Standalone View
src/test/util.cpp
Show All 26 Lines | std::string getnewaddress(const Config &config, CWallet &w) { | ||||
if (!w.GetNewDestination(output_type, "", dest, error)) { | if (!w.GetNewDestination(output_type, "", dest, error)) { | ||||
assert(false); | assert(false); | ||||
} | } | ||||
return EncodeDestination(dest, config); | return EncodeDestination(dest, config); | ||||
} | } | ||||
void importaddress(CWallet &wallet, const std::string &address) { | void importaddress(CWallet &wallet, const std::string &address) { | ||||
auto spk_man = wallet.GetLegacyScriptPubKeyMan(); | |||||
LOCK(wallet.cs_wallet); | LOCK(wallet.cs_wallet); | ||||
AssertLockHeld(spk_man->cs_wallet); | |||||
const auto dest = DecodeDestination(address, wallet.chainParams); | const auto dest = DecodeDestination(address, wallet.chainParams); | ||||
assert(IsValidDestination(dest)); | assert(IsValidDestination(dest)); | ||||
const auto script = GetScriptForDestination(dest); | const auto script = GetScriptForDestination(dest); | ||||
wallet.MarkDirty(); | wallet.MarkDirty(); | ||||
assert(!wallet.HaveWatchOnly(script)); | assert(!spk_man->HaveWatchOnly(script)); | ||||
if (!wallet.AddWatchOnly(script, 0 /* nCreateTime */)) { | if (!spk_man->AddWatchOnly(script, 0 /* nCreateTime */)) { | ||||
assert(false); | assert(false); | ||||
} | } | ||||
wallet.SetAddressBook(dest, /* label */ "", "receive"); | wallet.SetAddressBook(dest, /* label */ "", "receive"); | ||||
} | } | ||||
#endif // ENABLE_WALLET | #endif // ENABLE_WALLET | ||||
CTxIn generatetoaddress(const Config &config, const std::string &address) { | CTxIn generatetoaddress(const Config &config, const std::string &address) { | ||||
const auto dest = DecodeDestination(address, config.GetChainParams()); | const auto dest = DecodeDestination(address, config.GetChainParams()); | ||||
Show All 34 Lines |