Bitcoin Core  24.1.0
P2P Digital Currency
wallet.cpp
Go to the documentation of this file.
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 #include <test/util/wallet.h>
6 
7 #include <key_io.h>
8 #include <outputtype.h>
9 #include <script/standard.h>
10 #ifdef ENABLE_WALLET
11 #include <util/check.h>
12 #include <util/translation.h>
13 #include <wallet/wallet.h>
14 #endif
15 
16 using wallet::CWallet;
17 
18 const std::string ADDRESS_BCRT1_UNSPENDABLE = "bcrt1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3xueyj";
19 
20 #ifdef ENABLE_WALLET
21 std::string getnewaddress(CWallet& w)
22 {
23  constexpr auto output_type = OutputType::BECH32;
24  return EncodeDestination(*Assert(w.GetNewDestination(output_type, "")));
25 }
26 
27 #endif // ENABLE_WALLET
const std::string ADDRESS_BCRT1_UNSPENDABLE
Definition: wallet.cpp:18
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Definition: wallet.h:235
std::string getnewaddress(wallet::CWallet &w)
Returns a new address from the wallet.
std::string EncodeDestination(const CTxDestination &dest)
Definition: key_io.cpp:276
util::Result< CTxDestination > GetNewDestination(const OutputType type, const std::string label)
Definition: wallet.cpp:2381
#define Assert(val)
Identity function.
Definition: check.h:74