21#include <blockfilter.h>
54#include <boost/test/unit_test.hpp>
71 mtx.
vin.push_back({
CTxIn{from.GetHash(), index}});
74 std::map<COutPoint, Coin> coins;
75 coins[mtx.
vin[0].prevout].out = from.vout[index];
76 std::map<int, bilingual_str> input_errors;
100 auto& desc = descs.at(0);
115 ext_key.
SetSeed(std::array<std::byte, 32>{});
116 const std::string descriptor_without_checksum{
"wpkh(" +
EncodeExtKey(ext_key) +
"/*)"};
117 const std::string descriptor{descriptor_without_checksum +
"#" +
GetDescriptorChecksum(descriptor_without_checksum)};
119 const std::array invalid_ranges{
120 std::pair{std::pair<int64_t, int64_t>{2, 1},
"Range specified as [begin,end] must not have begin after end"},
121 std::pair{std::pair<int64_t, int64_t>{-1, 10},
"Range should be greater or equal than 0"},
122 std::pair{std::pair<int64_t, int64_t>{0, 1'000'000},
"Range is too large"},
123 std::pair{std::pair<int64_t, int64_t>{0, std::numeric_limits<int64_t>::max()},
"End of range is too high"},
124 std::pair{std::pair<int64_t, int64_t>{0, 1LL << 31},
"End of range is too high"},
127 for (
const auto& [range, expected_error] : invalid_ranges) {
133 .internal = std::nullopt,
135 .next_index = std::nullopt,
138 BOOST_REQUIRE_EQUAL(results.size(), 1U);
139 BOOST_REQUIRE(results.front().error.has_value());
141 BOOST_CHECK_EQUAL(results.front().error->wallet_error.message.original, expected_error);
142 BOOST_CHECK(!results.front().error->is_general_error);
153 EncryptionFailureSetup()
156 m_args.ForceSetArg(
"-keypool",
"1");
161 void RecreateWallet(uint64_t create_flags)
164 auto database{std::make_unique<FaultInjectingDatabase>()};
178 for (
bool success : {
false,
true}) {
213 for (
bool success : {
false,
true}) {
228 for (
bool success : {
false,
true}) {
241 BOOST_REQUIRE(
wallet->EncryptWallet(
"old_pass"));
242 BOOST_REQUIRE(
wallet->IsLocked());
244 BOOST_REQUIRE(master_key_record);
247 const auto changed{
wallet->ChangeWalletPassphrase(
"old_pass",
"new_pass")};
248 BOOST_REQUIRE(!changed);
250 BOOST_CHECK_EQUAL(changed.error().message.original,
"Error: Writing the new encryption key to the wallet database failed");
261 const auto unlocked{
wallet->Unlock(
"old_pass")};
262 BOOST_REQUIRE(!unlocked);
264 BOOST_CHECK_EQUAL(unlocked.error().message.original,
"Error: The wallet passphrase entered was incorrect.");
270 BOOST_REQUIRE(
wallet->EncryptWallet(
"passphrase"));
271 BOOST_REQUIRE(
wallet->Unlock(
"passphrase"));
281 enum class Failure { PlaintextWrite, EncryptedWrite, Erase, Commit };
282 for (
auto failure : {Failure::PlaintextWrite, Failure::EncryptedWrite, Failure::Erase, Failure::Commit}) {
283 const bool encrypted{failure != Failure::PlaintextWrite};
290 provider.keys.emplace(key.GetPubKey().GetID(), key);
293 return wallet->AddWalletDescriptor(descriptor,
provider,
"",
false);
297 return wallet->GetKey(key.GetPubKey().GetID()).has_value();
300 BOOST_REQUIRE(
wallet->EncryptWallet(
"passphrase"));
301 BOOST_REQUIRE(
wallet->Unlock(
"passphrase"));
306 if (failure == Failure::Erase) {
308 }
else if (failure == Failure::Commit) {
333 auto& desc{descs.at(0)};
377 wallet.SetLastBlockProcessed(newTip->nHeight, newTip->GetBlockHash());
381 std::chrono::steady_clock::time_point fake_time;
382 reserver.
setNow([&] { fake_time += 60
s;
return fake_time; });
388 BOOST_REQUIRE(!locator.
IsNull());
402 BOOST_REQUIRE(!locator.
IsNull());
440 file_number = newTip->GetBlockPos().nFile;
470 BOOST_REQUIRE(filter_index.Init());
478 const int stale_height{stale_block->
nHeight};
480 BOOST_REQUIRE(
m_node.
chainman->ActiveChainstate().InvalidateBlock(state, stale_block));
482 CreateAndProcessBlock({}, replacement_script);
483 CreateAndProcessBlock({}, replacement_script);
484 BOOST_REQUIRE(filter_index.BlockUntilSyncedToCurrentChain());
487 BOOST_REQUIRE(!
m_node.
chainman->ActiveChain().Contains(*stale_block));
488 BOOST_REQUIRE_EQUAL(
m_node.
chainman->ActiveChain().Height(), stale_height + 1);
493 BOOST_REQUIRE(filter_index.LookupFilter(stale_block, filter));
507 ScanResult result =
wallet.Scanner().Scan(stale_hash, stale_height, {}, reserver,
false);
526 ScanResult result =
wallet.Scanner().Scan(stale_hash, stale_height, {}, reserver,
false);
554 ScanResult result =
wallet.Scanner().Scan(stale_hash, stale_height, {}, reserver,
false);
575 genesis_hash =
m_node.
chainman->ActiveChain().Genesis()->GetBlockHash();
589 ScanResult result =
wallet.Scanner().Scan(genesis_hash, 0, {}, reserver,
false);
631 uint256 genesis_hash, max_hash, tip_hash;
632 int max_height, tip_height;
635 genesis_hash =
m_node.
chainman->ActiveChain().Genesis()->GetBlockHash();
638 max_height = tip_height - 2;
639 max_hash =
m_node.
chainman->ActiveChain()[max_height]->GetBlockHash();
649 wallet.SetLastBlockProcessed(tip_height, tip_hash);
654 ScanResult result =
wallet.Scanner().Scan(genesis_hash, 0, max_height, reserver,
false);
670 wallet.SetLastBlockProcessed(tip_height, tip_hash);
675 ScanResult result =
wallet.Scanner().Scan(tip_hash, tip_height, tip_height, reserver,
false);
688 int start_tip_height{0};
694 wallet.SetLastBlockProcessed(start_tip_height,
m_node.
chainman->ActiveChain().Tip()->GetBlockHash());
695 genesis_hash =
m_node.
chainman->ActiveChain().Genesis()->GetBlockHash();
704 bool extended{
false};
705 auto handler =
wallet.ShowProgress.connect([&](
const std::string&,
int) {
706 if (extended)
return;
713 wallet.SetLastBlockProcessed(new_tip->
nHeight, new_tip_hash);
718 ScanResult result =
wallet.Scanner().Scan(genesis_hash, 0, {}, reserver,
false);
728 uint256 genesis_hash, tip_hash;
736 genesis_hash =
m_node.
chainman->ActiveChain().Genesis()->GetBlockHash();
744 std::chrono::steady_clock::time_point fake_time;
745 reserver.
setNow([&] { fake_time += 60
s;
return fake_time; });
748 ScanResult result =
wallet.Scanner().Scan(genesis_hash, 0, max_height, reserver,
false);
795 bool scan_logged{
false};
796 DebugLogHelper scan_check{
"Rescan started from block", [&](
const std::string*
s) {
797 if (
s) scan_logged =
true;
813 BOOST_REQUIRE(filter_index.Init());
817 uint256 genesis_hash, tip_hash;
823 genesis_hash =
m_node.
chainman->ActiveChain().Genesis()->GetBlockHash();
826 tip_hash = tip->GetBlockHash();
827 wallet.SetLastBlockProcessed(tip_height, tip_hash);
829 BOOST_REQUIRE(!filter_index.LookupFilter(tip, filter));
834 bool fast_scan_logged{
false};
835 DebugLogHelper scan_check{
"fast variant using block filters", [&](
const std::string*
s) {
836 if (
s) fast_scan_logged =
true;
839 ScanResult result =
wallet.Scanner().Scan(genesis_hash, 0, {}, reserver,
false);
840 BOOST_REQUIRE(fast_scan_logged);
859 m_args.ForceSetArg(
"-unsafesqlitesync",
"1");
870 constexpr int NEW_BLOCKS{5};
871 for (
int i = 0; i < NEW_BLOCKS; ++i) {
902 const auto NUM_WALLETS{5};
905 BOOST_REQUIRE(chain->getRwSetting(
"wallet").isNull());
907 const auto& check_concurrent_wallet = [&](
const auto& settings_function,
int num_expected_wallets) {
908 std::vector<std::thread> threads;
909 threads.reserve(NUM_WALLETS);
910 for (
auto i{0}; i < NUM_WALLETS; ++i) threads.emplace_back(settings_function, i);
911 for (
auto&
t : threads)
t.join();
913 auto wallets = chain->getRwSetting(
"wallet");
918 check_concurrent_wallet([&chain](
int i) {
924 check_concurrent_wallet([&chain](
int i) {
939 auto inserted = chainman.
BlockIndex().emplace(std::piecewise_construct, std::make_tuple(
GetRandHash()), std::make_tuple());
941 const uint256& hash = inserted.first->first;
942 block = &inserted.first->second;
943 block->
nTime = blockTime;
989 std::vector<bilingual_str> warnings;
991 auto wallet{std::make_shared<CWallet>(chain.get(),
"", std::move(database))};
1001 BOOST_CHECK(!wallet->IsAddressPreviouslySpent(PKHash()));
1002 WalletBatch batch{wallet->GetDatabase()};
1012 BOOST_CHECK(wallet->IsAddressPreviouslySpent(PKHash()));
1013 BOOST_CHECK(wallet->IsAddressPreviouslySpent(ScriptHash()));
1014 auto requests = wallet->GetAddressReceiveRequests();
1015 auto erequests = {
"val_rr11",
"val_rr20"};
1016 BOOST_CHECK_EQUAL_COLLECTIONS(requests.begin(), requests.end(), std::begin(erequests), std::end(erequests));
1018 BOOST_CHECK(batch.WriteAddressPreviouslySpent(PKHash(), false));
1019 BOOST_CHECK(batch.EraseAddressData(ScriptHash()));
1024 BOOST_CHECK(!wallet->IsAddressPreviouslySpent(PKHash()));
1025 BOOST_CHECK(!wallet->IsAddressPreviouslySpent(ScriptHash()));
1026 auto requests = wallet->GetAddressReceiveRequests();
1027 auto erequests = {
"val_rr11"};
1028 BOOST_CHECK_EQUAL_COLLECTIONS(requests.begin(), requests.end(), std::begin(erequests), std::end(erequests));
1056 wallet->CommitTransaction(tx);
1067 auto it =
wallet->mapWallet.find(tx->GetHash());
1078 std::string coinbaseAddress = coinbaseKey.GetPubKey().GetID().ToString();
1082 std::map<CTxDestination, std::vector<COutput>> list;
1088 BOOST_CHECK_EQUAL(std::get<PKHash>(list.begin()->first).ToString(), coinbaseAddress);
1104 BOOST_CHECK_EQUAL(std::get<PKHash>(list.begin()->first).ToString(), coinbaseAddress);
1112 for (
const auto&
group : list) {
1113 for (
const auto& coin :
group.second) {
1115 wallet->LockCoin(coin.outpoint,
false);
1129 BOOST_CHECK_EQUAL(std::get<PKHash>(list.begin()->first).ToString(), coinbaseAddress);
1134 std::map<OutputType, size_t>& expected_coins_sizes)
1143 for (uint32_t i = 0; i < wtx.
GetTx()->vout.size(); i++)
context.wallet->LockCoin({wtx.
GetHash(), i},
false);
1144 for (
const auto& [type, size] : expected_coins_sizes)
BOOST_CHECK_EQUAL(size, available_coins.
coins[type].size());
1149 std::map<OutputType, size_t> expected_coins_sizes;
1150 for (
const auto& out_type :
OUTPUT_TYPES) { expected_coins_sizes[out_type] = 0U; }
1168 expected_coins_sizes[out_type] = 2U;
1194 CScript inner_script =
CScript() << OP_0 << std::vector<unsigned char>(key_hash.
begin(), key_hash.
end());
1226 std::string
s(e.what());
1227 return s.find(
"Missing checksum") != std::string::npos;
1232 std::vector<unsigned char> malformed_record;
1234 vw << std::string(
"notadescriptor");
1241 std::optional<WalletDescriptor> w_desc;
1265 m_args.ForceSetArg(
"-unsafesqlitesync",
"1");
1278 int addtx_count = 0;
1279 DebugLogHelper addtx_counter(
"[default wallet] AddToWallet", [&](
const std::string*
s) {
1280 if (
s) ++addtx_count;
1285 bool rescan_completed =
false;
1286 DebugLogHelper rescan_check(
"[default wallet] Rescan completed", [&](
const std::string*
s) {
1287 if (
s) rescan_completed =
true;
1295 std::promise<void> promise;
1297 promise.get_future().wait();
1300 m_coinbase_txns.push_back(CreateAndProcessBlock({},
GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]);
1302 m_coinbase_txns.push_back(CreateAndProcessBlock({block_tx},
GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]);
1322 promise.set_value();
1341 m_coinbase_txns.push_back(CreateAndProcessBlock({},
GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]);
1343 m_coinbase_txns.push_back(CreateAndProcessBlock({block_tx},
GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]);
1373 m_args.ForceSetArg(
"-unsafesqlitesync",
"1");
1381 m_coinbase_txns.push_back(CreateAndProcessBlock({},
GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]);
1388 auto block_hash = block_tx.GetHash();
1389 auto prev_tx = m_coinbase_txns[0];
1395 std::vector<Txid> vHashIn{ block_hash };
int64_t CAmount
Amount in satoshis (Can be negative)
constexpr CAmount COIN
The amount of satoshis in one BTC.
bool DestroyBlockFilterIndex(BlockFilterType filter_type)
Destroy the block filter index with the given type.
BlockFilterIndex * GetBlockFilterIndex(BlockFilterType filter_type)
Get a block filter index by type.
bool InitBlockFilterIndex(std::function< std::unique_ptr< interfaces::Chain >()> make_chain, BlockFilterType filter_type, size_t n_cache_size, bool f_memory, bool f_wipe)
Initialize a block filter index for the given type if one does not already exist.
constexpr int64_t TIMESTAMP_WINDOW
Timestamp window used as a grace period by code that compares external timestamps (such as timestamps...
#define Assert(val)
Identity function.
Complete block filter struct as defined in BIP 157.
BlockFilterIndex is used to store and retrieve block filters, hashes, and headers for a range of bloc...
The block chain is a tree shaped structure starting with the genesis block at the root,...
uint256 GetBlockHash() const
int64_t GetBlockTimeMax() const
int nHeight
height of the entry in the chain. The genesis block has height 0
FlatFilePos GetBlockPos() const EXCLUSIVE_LOCKS_REQUIRED(
const uint256 * phashBlock
pointer to the hash of the block, if any. Memory is owned by this CBlockIndex
Fee rate in satoshis per virtualbyte: CAmount / vB the feerate is represented internally as FeeFrac.
CAmount GetFeePerK() const
Return the fee in satoshis for a vsize of 1000 vbytes.
An encapsulated private key.
CPubKey GetPubKey() const
Compute the public key from a private key.
An encapsulated public key.
Serialized script, used inside transaction inputs and outputs.
The basic transaction that is broadcasted on the network and contained in blocks.
An input of a transaction.
CCoinsViewCache & CoinsTip() EXCLUSIVE_LOCKS_REQUIRED(
Interface for managing multiple Chainstate objects, where each chainstate is associated with chainsta...
node::BlockMap & BlockIndex() EXCLUSIVE_LOCKS_REQUIRED(
Chainstate & ActiveChainstate() const
Alternatives to CurrentChainstate() used by older code to query latest chainstate information without...
Helper to initialize the global NodeClock, let a duration elapse, and reset it after use in a test.
Fillable signing provider that keeps keys in an address->secret map.
virtual bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey)
virtual bool AddCScript(const CScript &redeemScript)
virtual bool AddKey(const CKey &key)
BOOST_CHECK_EXCEPTION predicates to check the specific validation error.
Minimal stream for reading from an existing byte array by std::span.
constexpr bool IsNull() const
constexpr unsigned char * end()
constexpr unsigned char * begin()
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
virtual bool broadcastTransaction(const CTransactionRef &tx, const CAmount &max_tx_fee, const CFeeRate &max_tx_fee_rate, node::TxBroadcast broadcast_method, std::string &err_string)=0
Process a local transaction, optionally adding it to the mempool and optionally broadcasting it to th...
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
A transaction with a bunch of additional info that only the owner cares about.
const Txid & GetHash() const LIFETIMEBOUND
CTransactionRef GetTx() const
void FailNextWrite(std::string record_type, size_t match_skip_count=0)
bool HasRecordType(const std::string &record_type)
std::optional< SerializeData > GetRecordValue(const std::string &record_type)
void FailNextErase(std::string record_type)
CWalletTx & AddTx(CRecipient recipient)
std::unique_ptr< CWallet > wallet
Access to the wallet database.
Descriptor with some wallet metadata.
RAII object to check and reserve a wallet rescan.
bool reserve(bool with_passphrase=false)
static UniValue Parse(std::string_view raw, ParamFormat format=ParamFormat::JSON)
Parse string to UniValue or throw runtime_error if string contains invalid JSON.
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
BOOST_FIXTURE_TEST_SUITE(cuckoocache_tests, BasicTestingSetup)
Test Suite for CuckooCache.
BOOST_AUTO_TEST_SUITE_END()
uint160 Hash160(const T1 &in1)
Compute the 160-bit hash an object.
std::string HexStr(const std::span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
BOOST_CHECK_EQUAL(headers.FindFirst("key"), "value")
BOOST_CHECK_EXCEPTION(HTTPHeaders{}.Read(reader), std::runtime_error, HasReason{"Empty HTTP header name"})
CKey GenerateRandomKey(bool compressed) noexcept
std::string EncodeExtKey(const CExtKey &key)
std::string EncodeSecret(const CKey &key)
std::unique_ptr< Chain > MakeChain(node::NodeContext &node)
Return implementation of Chain interface.
@ MEMPOOL_NO_BROADCAST
Add the transaction to the mempool, but don't broadcast to anybody.
constexpr unsigned int MAX_BLOCKFILE_SIZE
The maximum size of a blk?????.dat file (since 0.8)
const std::string WALLETDESCRIPTORCKEY
const std::string WALLETDESCRIPTORKEY
const std::string MASTER_KEY
constexpr size_t DUMMY_NESTED_P2WPKH_INPUT_SIZE
Pre-calculated constants for input size estimation in virtual size
static CMutableTransaction TestSimpleSpend(const CTransaction &from, uint32_t index, const CKey &key, const CScript &pubkey)
wallet::DescriptorScriptPubKeyMan * CreateDescriptor(CWallet &keystore, const std::string &desc_str, const bool success)
std::unique_ptr< WalletDatabase > CreateMockableWalletDatabase()
void TestLoadWallet(const std::string &name, DatabaseFormat format, std::function< void(std::shared_ptr< CWallet >)> f)
util::Result< CreatedTransactionResult > CreateTransaction(CWallet &wallet, const std::vector< CRecipient > &vecSend, std::optional< unsigned int > change_pos, const CCoinControl &coin_control, bool sign)
Create a new transaction paying the recipients with a set of coins selected by SelectCoins(); Also cr...
constexpr CAmount DEFAULT_TRANSACTION_MAXFEE
-maxtxfee default
static bool RunWithinTxn(WalletBatch &batch, std::string_view process_desc, const std::function< bool(WalletBatch &)> &func)
std::variant< TxStateConfirmed, TxStateInMempool, TxStateBlockConflicted, TxStateInactive, TxStateUnrecognized > TxState
All possible CWalletTx states.
BOOST_FIXTURE_TEST_CASE(wallet_coinsresult_test, BasicTestingSetup)
std::vector< ImportResult > ProcessDescriptorsImport(CWallet &wallet, std::vector< ImportDescriptorRequest > &requests)
bool AddWalletSetting(interfaces::Chain &chain, const std::string &wallet_name)
Add wallet name to persistent configuration so it will be loaded on startup.
@ PassphraseIncorrect
The passphrase does not decrypt the wallet. Callers may ask the user to enter it again.
@ GenericError
Generic wallet error.
bool RemoveWalletSetting(interfaces::Chain &chain, const std::string &wallet_name)
Remove wallet name from persistent configuration so it will not be loaded on startup.
std::unique_ptr< interfaces::Handler > HandleLoadWallet(WalletContext &context, LoadWalletFn load_wallet)
std::unique_ptr< CWallet > CreateSyncedWallet(interfaces::Chain &chain, CChain &cchain, const CKey &key)
constexpr CAmount WALLET_INCREMENTAL_RELAY_FEE
minimum recommended increment for replacement txs
void TestUnloadWallet(std::shared_ptr< CWallet > &&wallet)
static void AddTx(CWallet &wallet)
std::unique_ptr< WalletDatabase > MakeWalletDatabase(const std::string &name, const DatabaseOptions &options, DatabaseStatus &status, bilingual_str &error_string)
std::map< CTxDestination, std::vector< COutput > > ListCoins(const CWallet &wallet)
Return list of available coins and locked coins grouped by non-change output address.
BOOST_AUTO_TEST_CASE(bnb_test)
constexpr DatabaseFormat DATABASE_FORMATS[]
static void AddKey(CWallet &wallet, const CKey &key)
std::shared_ptr< CWallet > TestLoadWallet(std::unique_ptr< WalletDatabase > database, WalletContext &context)
static bool BroadcastTestSimpleSpend(interfaces::Chain &chain, ChainstateManager &chainman, const CMutableTransaction &tx, std::string &error)
Balance GetBalance(const CWallet &wallet, const int min_depth, bool avoid_reuse, bool include_nonmempool)
std::shared_ptr< CWallet > TestCreateWallet(std::unique_ptr< WalletDatabase > database, WalletContext &context, uint64_t create_flags)
static int64_t AddTx(ChainstateManager &chainman, CWallet &wallet, uint32_t lockTime, std::chrono::seconds mock_time, int64_t blockTime)
bool malformed_descriptor(std::ios_base::failure e)
constexpr CAmount DEFAULT_TRANSACTION_MINFEE
-mintxfee default
std::shared_ptr< CWallet > CreateWallet(WalletContext &context, const std::string &name, std::optional< bool > load_on_start, DatabaseOptions &options, DatabaseStatus &status, bilingual_str &error, std::vector< bilingual_str > &warnings)
void TestCoinsResult(ListCoinsTest &context, OutputType out_type, CAmount amount, std::map< OutputType, size_t > &expected_coins_sizes)
@ WALLET_FLAG_DESCRIPTORS
Indicate that this wallet supports DescriptorScriptPubKeyMan.
@ WALLET_FLAG_DISABLE_PRIVATE_KEYS
@ WALLET_FLAG_BLANK_WALLET
Flag set when a wallet contains no HD seed and no private keys, scripts, addresses,...
void WaitForDeleteWallet(std::shared_ptr< CWallet > &&wallet)
Explicitly delete the wallet.
static size_t CalculateNestedKeyhashInputSize(bool use_max_sig)
BOOST_FIXTURE_TEST_CASE(RemoveTxs, TestChain100Setup)
is a home for public enum and struct type definitions that are used internally by node code,...
#define BOOST_CHECK(expr)
constexpr auto OUTPUT_TYPES
unsigned int nBytesPerSigOp
int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost, unsigned int bytes_per_sigop)
Compute the virtual transaction size (weight reinterpreted as bytes).
int64_t GetVirtualTransactionInputSize(const CTxIn &txin, int64_t nSigOpCost, unsigned int bytes_per_sigop)
constexpr script_verify_flags STANDARD_SCRIPT_VERIFY_FLAGS
Standard script verification flags that standard transactions will comply with.
constexpr unsigned int DEFAULT_INCREMENTAL_RELAY_FEE
Default for -incrementalrelayfee, which sets the minimum feerate increase for mempool limiting or rep...
constexpr unsigned int DEFAULT_MIN_RELAY_TX_FEE
Default for -minrelaytxfee, minimum relay fee for transactions.
static CTransactionRef MakeTransactionRef(Tx &&txIn)
std::shared_ptr< const CTransaction > CTransactionRef
uint256 GetRandHash() noexcept
Generate a random uint256.
void SignTransaction(CMutableTransaction &mtx, const SigningProvider *keystore, const std::map< COutPoint, Coin > &coins, const UniValue &hashType, UniValue &result)
Sign a transaction with the given keystore and previous transactions.
bool(* handler)(const std::any &context, HTTPRequest *req, const std::string &strReq)
std::string GetDescriptorChecksum(const std::string &descriptor)
Get the checksum for a descriptor.
constexpr deserialize_type deserialize
bool ProduceSignature(const SigningProvider &provider, const BaseSignatureCreator &creator, const CScript &fromPubKey, SignatureData &sigdata)
Produce a script signature using a generic signature creator.
void UpdateInput(CTxIn &input, const SignatureData &data)
const BaseSignatureCreator & DUMMY_MAXIMUM_SIGNATURE_CREATOR
A signature creator that just produces 72-byte empty signatures.
static bool GetPubKey(const SigningProvider &provider, const SignatureData &sigdata, const CKeyID &address, CPubKey &pubkey)
const BaseSignatureCreator & DUMMY_SIGNATURE_CREATOR
A signature creator that just produces 71-byte empty signatures.
CScript GetScriptForRawPubKey(const CPubKey &pubKey)
Generate a P2PK script for the given pubkey.
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
std::vector< uint256 > vHave
void SetSeed(std::span< const std::byte > seed)
A mutable version of CTransaction.
std::vector< CTxOut > vout
Testing fixture that pre-creates a 100-block REGTEST-mode block chain.
Testing setup that configures a complete environment.
NodeContext struct containing references to chain state and connection state.
std::unique_ptr< ValidationSignals > validation_signals
Issues calls about blocks and transactions.
std::unique_ptr< ChainstateManager > chainman
std::unique_ptr< interfaces::Chain > chain
COutputs available for spending, stored by OutputType.
size_t Size() const
The following methods are provided so that CoinsResult can mimic a vector, i.e., methods can work wit...
std::map< OutputType, std::vector< COutput > > coins
std::optional< DatabaseFormat > require_format
Information about a descriptor to be imported.
uint256 last_scanned_block
Hash and height of most recent block that was successfully scanned.
enum wallet::ScanResult::@19 status
std::optional< int > last_scanned_height
uint256 last_failed_block
Height of the most recent block that could not be scanned due to read errors or pruning.
State of transaction confirmed in a block.
State of transaction not confirmed or conflicting with a known block and not in the mempool.
WalletContext struct containing references to state shared between CWallet instances,...
interfaces::Chain * chain
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
FuzzedDataProvider provider
#define EXCLUSIVE_LOCKS_REQUIRED(...)
int64_t GetTransactionSigOpCost(const CTransaction &tx, const CCoinsViewCache &inputs, script_verify_flags flags)
Compute total signature operation cost of a transaction.
std::shared_ptr< CWallet > m_wallet
static void AvailableCoins(benchmark::Bench &bench, const std::vector< OutputType > &output_type)
std::shared_ptr< CWallet > wallet
FaultInjectingDatabase * fail_db