mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-03 16:30:42 +02:00
Merge #15582: Fix overflow bug in analyzepsbt fee: CAmount instead of int
c9963ae8b1a4d26d19c58e18fde9c85783edb788 Fix overflow bug in analyzepsbt fee: CAmount instead of int (Pieter Wuille) Pull request description: This causes the `fee` and `estimated_feerate` values in the the analyzepsbt output to be off if the amount being spent exceed 21.47483647 BTC. Tree-SHA512: 61c1e26894617c51cc5fc026a3677a0b759fcbac1e70efa7fdc68d57cfd484525e18c906f1b8c06fd5d846b74a3cb4bc0bbd302a6eeaade79055a47d6d0dacc2
This commit is contained in:
commit
59b291966e
@ -1981,8 +1981,8 @@ UniValue analyzepsbt(const JSONRPCRequest& request)
|
||||
}
|
||||
if (calc_fee) {
|
||||
// Get the output amount
|
||||
CAmount out_amt = std::accumulate(psbtx.tx->vout.begin(), psbtx.tx->vout.end(), 0,
|
||||
[](int a, const CTxOut& b) {
|
||||
CAmount out_amt = std::accumulate(psbtx.tx->vout.begin(), psbtx.tx->vout.end(), CAmount(0),
|
||||
[](CAmount a, const CTxOut& b) {
|
||||
return a += b.nValue;
|
||||
}
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user