diff options
author | Andrew Chow <achow101-github@achow101.com> | 2019-06-18 15:19:13 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2019-07-09 16:43:10 -0400 |
commit | 172213be5b174243dc501c1103ad5fe2fee67a16 (patch) | |
tree | 2f890eb657ffa7b95ff6fb7e04b58a58c4ba081f /src/test | |
parent | 0853d8d2fd3cd19c3aea495f228222c7a8536e08 (diff) |
Add GetNewDestination to CWallet to fetch new destinations
Instead of having the same multiple lines of code everywhere
that new destinations are fetched, introduce GetNewDestination as
a member function of CWallet which does the key fetching, label
setting, script generation, and destination generation.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/util.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/test/util.cpp b/src/test/util.cpp index bc09d00b7a..44afba1a02 100644 --- a/src/test/util.cpp +++ b/src/test/util.cpp @@ -25,14 +25,9 @@ const std::string ADDRESS_BCRT1_UNSPENDABLE = "bcrt1qqqqqqqqqqqqqqqqqqqqqqqqqqqq std::string getnewaddress(CWallet& w) { constexpr auto output_type = OutputType::BECH32; - - CPubKey new_key; - if (!w.GetKeyFromPool(new_key)) assert(false); - - w.LearnRelatedScripts(new_key, output_type); - const auto dest = GetDestinationForKey(new_key, output_type); - - w.SetAddressBook(dest, /* label */ "", "receive"); + CTxDestination dest; + std::string error; + if (!w.GetNewDestination(output_type, "", dest, error)) assert(false); return EncodeDestination(dest); } |