Skip to content

Commit

Permalink
Introduce function add coins by effective value
Browse files Browse the repository at this point in the history
  • Loading branch information
murchandamus committed Oct 18, 2023
1 parent ef5e98d commit b2bb995
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/wallet/test/coinselector_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ static const CoinEligibilityFilter filter_confirmed(1, 1, 0);
static const CoinEligibilityFilter filter_standard_extra(6, 6, 0);
static int nextLockTime = 0;

static void add_coin_by_effective_value(std::vector<COutput>& utxo_pool, const CAmount& eff_value, int nInput = 0, int input_bytes = 68, CFeeRate feerate = CFeeRate(3))
{
CMutableTransaction tx;
tx.vout.resize(nInput + 1);
tx.vout[nInput].nValue = eff_value + feerate.GetFee(input_bytes);
tx.nLockTime = nextLockTime++; // so all transactions get different hashes
utxo_pool.emplace_back(COutPoint(tx.GetHash(), nInput), tx.vout.at(nInput), /*depth=*/ 1, /*input_bytes=*/ input_bytes, /*spendable=*/ true, /*solvable=*/ true, /*safe=*/ true, /*time=*/ 0, /*from_me=*/ false, /*fees=*/ feerate.GetFee(input_bytes));
}

static void add_coin(const CAmount& nValue, int nInput, std::vector<COutput>& set)
{
CMutableTransaction tx;
Expand Down

0 comments on commit b2bb995

Please sign in to comment.