15#include <boost/test/unit_test.hpp>
24 BOOST_REQUIRE(provider.
AddKey(key));
55 const auto& txr = *res;
57 BOOST_CHECK_EQUAL(txr.tx->vout[0].nValue, recipient.nAmount + leftover_input_amount - txr.fee);
58 BOOST_CHECK_GT(txr.fee, 0);
86 for (
int i = 0; i < 4; i++) CreateAndProcessBlock({},
GetScriptForRawPubKey(coinbaseKey.GetPubKey()));
91 std::vector<COutput> coins = available_coins.All();
93 std::set<COutPoint> preset_inputs = {coins[0].outpoint, coins[1].outpoint, coins[2].outpoint};
101 for (
const auto& outpoint : preset_inputs) {
102 coin_control.
Select(outpoint);
120 recipients[0].fSubtractFeeFromAmount =
false;
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
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.
An encapsulated private key.
An outpoint - a combination of a transaction hash and an index n into its vout.
An output of a transaction.
Fillable signing provider that keeps keys in an address->secret map.
virtual bool AddKey(const CKey &key)
std::optional< OutputType > m_change_type
Override the default change type if set, ignored if destChange is set.
PreselectedInput & Select(const COutPoint &outpoint)
Lock-in the given output for spending.
bool m_allow_other_inputs
If true, the selection process can add extra unselected inputs from the wallet while requires all sel...
bool fOverrideFeeRate
Override automatic min/max checks on fee, m_feerate must be set if true.
std::optional< CFeeRate > m_feerate
Override the wallet's fee rate if set.
BOOST_FIXTURE_TEST_SUITE(cuckoocache_tests, BasicTestingSetup)
Test Suite for CuckooCache.
BOOST_AUTO_TEST_SUITE_END()
CKey GenerateRandomKey(bool compressed) noexcept
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...
BOOST_FIXTURE_TEST_CASE(wallet_coinsresult_test, BasicTestingSetup)
std::unique_ptr< CWallet > CreateSyncedWallet(interfaces::Chain &chain, CChain &cchain, const CKey &key)
BOOST_AUTO_TEST_CASE(bnb_test)
int CalculateMaximumSignedInputSize(const CTxOut &txout, const COutPoint outpoint, const SigningProvider *provider, bool can_grind_r, const CCoinControl *coin_control)
CoinsResult AvailableCoins(const CWallet &wallet, const CCoinControl *coinControl, std::optional< CFeeRate > feerate, const CoinFilterParams ¶ms)
Populate the CoinsResult struct with vectors of available COutputs, organized by OutputType.
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
CScript GetScriptForRawPubKey(const CPubKey &pubKey)
Generate a P2PK script for the given pubkey.
Testing fixture that pre-creates a 100-block REGTEST-mode block chain.
std::unique_ptr< ChainstateManager > chainman
std::unique_ptr< interfaces::Chain > chain
#define WITH_LOCK(cs, code)
Run code while locking a mutex.