diff options
author | Andrew Chow <achow101-github@achow101.com> | 2022-05-23 12:51:06 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2022-05-23 12:55:24 -0400 |
commit | 3368f84c4359750cebe48df7f3f551460f7e4372 (patch) | |
tree | d0596696481821639a2331d05764686d52b50293 /src/wallet/rpc/coins.cpp | |
parent | 5ebff43025e4a29a58395256944cfc22231fec48 (diff) | |
parent | 6fbb0edac22c63f1b723f731c2601b1d46879a58 (diff) | |
download | bitcoin-3368f84c4359750cebe48df7f3f551460f7e4372.tar.xz |
Merge bitcoin/bitcoin#25083: Set effective_value when initializing a COutput
6fbb0edac22c63f1b723f731c2601b1d46879a58 Set effective_value when initializing a COutput (ishaanam)
Pull request description:
Previously in COutput, effective_value was initialized as the absolute value of the txout and the fee as 0. effective_value along with the fee was calculated outside of the COutput constructor and set after the object had been initialized.
These changes will allow either the fee or the feerate to be passed in a COutput constructor and the fee and effective_value are calculated and set in the constructor. As a result, AvailableCoins also needs to be passed the feerate when utxos are being spent. When balance is calculated or the coins are being listed and feerate is neither available nor required, AvailableCoinsListUnspent is used instead, which runs AvailableCoins while providing the default value for `feerate`. Unit tests for the calculation of effective value have also been added.
ACKs for top commit:
achow101:
re-ACK 6fbb0edac22c63f1b723f731c2601b1d46879a58
Xekyo:
re-ACK 6fbb0edac22c63f1b723f731c2601b1d46879a58
w0xlt:
Code Review ACK https://github.com/bitcoin/bitcoin/pull/25083/commits/6fbb0edac22c63f1b723f731c2601b1d46879a58
furszy:
Looks good, have been touching this area lately, code review ACK 6fbb0eda.
Tree-SHA512: 5943ee4f4b0c1dcfe146f2fc22853e607259d6d53156b80a8a8f4baa70760a8b25ab822777b7f5d21ecb02dac08bdee704a9a918d5660276d6994b19a284b256
Diffstat (limited to 'src/wallet/rpc/coins.cpp')
-rw-r--r-- | src/wallet/rpc/coins.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/wallet/rpc/coins.cpp b/src/wallet/rpc/coins.cpp index 5827a64760..2649fa586c 100644 --- a/src/wallet/rpc/coins.cpp +++ b/src/wallet/rpc/coins.cpp @@ -638,7 +638,7 @@ RPCHelpMan listunspent() cctl.m_max_depth = nMaxDepth; cctl.m_include_unsafe_inputs = include_unsafe; LOCK(pwallet->cs_wallet); - AvailableCoins(*pwallet, vecOutputs, &cctl, nMinimumAmount, nMaximumAmount, nMinimumSumAmount, nMaximumCount); + AvailableCoinsListUnspent(*pwallet, vecOutputs, &cctl, nMinimumAmount, nMaximumAmount, nMinimumSumAmount, nMaximumCount); } LOCK(pwallet->cs_wallet); |