Line data Source code
1 : // Copyright (c) 2019-2021 The Bitcoin Core developers 2 : // Distributed under the MIT software license, see the accompanying 3 : // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 : 5 : #if defined(HAVE_CONFIG_H) 6 : #include <config/bitcoin-config.h> 7 : #endif 8 : 9 : #include <test/util/wallet.h> 10 : 11 : #include <key_io.h> 12 : #include <outputtype.h> 13 : #include <script/standard.h> 14 : #ifdef ENABLE_WALLET 15 : #include <util/check.h> 16 : #include <util/translation.h> 17 : #include <wallet/wallet.h> 18 : #endif 19 : 20 : using wallet::CWallet; 21 : 22 0 : const std::string ADDRESS_B58T_UNSPENDABLE = "yXXXXXXXXXXXXXXXXXXXXXXXXXXXVd2rXU"; 23 0 : const std::string ADDRESS_BCRT1_UNSPENDABLE = "bcrt1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3xueyj"; 24 : 25 : #ifdef ENABLE_WALLET 26 0 : std::string getnewaddress(CWallet& w) 27 : { 28 0 : return EncodeDestination(*Assert(w.GetNewDestination(""))); 29 0 : } 30 : 31 : // void importaddress(CWallet& wallet, const std::string& address) 32 : // { 33 : // auto spk_man = wallet.GetLegacyScriptPubKeyMan(); 34 : // assert(spk_man != nullptr); 35 : // LOCK2(wallet.cs_wallet, spk_man->cs_KeyStore); 36 : // const auto dest = DecodeDestination(address); 37 : // assert(IsValidDestination(dest)); 38 : // const auto script = GetScriptForDestination(dest); 39 : // wallet.MarkDirty(); 40 : // assert(!spk_man->HaveWatchOnly(script)); 41 : // if (!spk_man->AddWatchOnly(script, 0 /* nCreateTime */)) assert(false); 42 : // wallet.SetAddressBook(dest, /*label=*/"", "receive"); 43 : // } 44 : #endif // ENABLE_WALLET