12#include <boost/test/unit_test.hpp>
25 wallet->SetupDescriptorScriptPubKeyMans();
40 tx.
vout[0].nValue = nValue;
48 const auto& txout = wtx.
tx->vout.at(0);
80 std::shared_ptr<CWallet>
wallet{
nullptr};
86 bool avoid_partial_spends,
91 std::vector<OutputGroup>& groups_out = positive_only ? groups.
groups_by_type[type].positive_group :
98 int expected_with_partial_spends_size,
99 int expected_without_partial_spends_size,
103 GroupVerify(type, filter,
false, positive_only, expected_with_partial_spends_size);
105 GroupVerify(type, filter,
true, positive_only, expected_without_partial_spends_size);
123 unsigned long GROUP_SIZE = 10;
125 for (
unsigned long i = 0; i < GROUP_SIZE; i++) {
141 for (
unsigned long i = 0; i < GROUP_SIZE; i++) {
212 uint16_t NUM_SINGLE_ENTRIES = 101;
213 for (
unsigned long i = 0; i < NUM_SINGLE_ENTRIES; i++) {
218 int PREVIOUS_ROUND_COUNT = GROUP_SIZE * 2 + 1;
221 PREVIOUS_ROUND_COUNT + NUM_SINGLE_ENTRIES,
228 avoid_partial_groups_filter,
229 PREVIOUS_ROUND_COUNT + NUM_SINGLE_ENTRIES,
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
std::variant< CNoDestination, PubKeyDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, PayToAnchor, WitnessUnknown > CTxDestination
A txout script categorized into standard templates.
int64_t CAmount
Amount in satoshis (Can be negative)
static constexpr CAmount COIN
The amount of satoshis in one BTC.
#define Assert(val)
Identity function.
Fee rate in satoshis per kilovirtualbyte: CAmount / kvB.
An outpoint - a combination of a transaction hash and an index n into its vout.
const uint256 & ToUint256() const LIFETIMEBOUND
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
int64_t GetTxTime() const
void GroupAndVerify(const OutputType type, const CoinEligibilityFilter &filter, int expected_with_partial_spends_size, int expected_without_partial_spends_size, bool positive_only)
void GroupVerify(const OutputType type, const CoinEligibilityFilter &filter, bool avoid_partial_spends, bool positive_only, int expected_size)
std::shared_ptr< CWallet > wallet
BOOST_FIXTURE_TEST_SUITE(cuckoocache_tests, BasicTestingSetup)
Test Suite for CuckooCache.
BOOST_AUTO_TEST_SUITE_END()
FilteredOutputGroups GroupOutputs(const CWallet &wallet, const CoinsResult &coins, const CoinSelectionParams &coin_sel_params, const std::vector< SelectionFilter > &filters, std::vector< OutputGroup > &ret_discarded_groups)
static std::unique_ptr< CWallet > NewWallet(const node::NodeContext &m_node, const std::string &wallet_name="")
std::unique_ptr< WalletDatabase > CreateMockableWalletDatabase(MockableData records)
BOOST_AUTO_TEST_CASE(bnb_search_test)
CoinSelectionParams makeSelectionParams(FastRandomContext &rand, bool avoid_partial_spends)
@ WALLET_FLAG_DESCRIPTORS
Indicate that this wallet supports DescriptorScriptPubKeyMan.
int CalculateMaximumSignedInputSize(const CTxOut &txout, const COutPoint outpoint, const SigningProvider *provider, bool can_grind_r, const CCoinControl *coin_control)
static void addCoin(CoinsResult &coins, CWallet &wallet, const CTxDestination &dest, const CAmount &nValue, bool is_from_me, CFeeRate fee_rate=CFeeRate(0), int depth=6)
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
std::optional< OutputType > OutputTypeFromDestination(const CTxDestination &dest)
Get the OutputType for a CTxDestination.
static CTransactionRef MakeTransactionRef(Tx &&txIn)
static constexpr CAmount CENT
A mutable version of CTransaction.
std::vector< CTxOut > vout
Txid GetHash() const
Compute the hash of this CMutableTransaction.
Testing setup that configures a complete environment.
std::unique_ptr< interfaces::Chain > chain
Parameters for filtering which OutputGroups we may use in coin selection.
Parameters for one iteration of Coin Selection.
COutputs available for spending, stored by OutputType.
void Add(OutputType type, const COutput &out)
std::map< OutputType, std::vector< COutput > > coins
Stores several 'Groups' whose were mapped by output type.
std::map< OutputType, Groups > groups_by_type
State of transaction not confirmed or conflicting with a known block and not in the mempool.