Merge #15582: Fix overflow bug in analyzepsbt fee: CAmount instead of int
c9963ae8b1
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
1 changed files with 2 additions and 2 deletions
|
@ -1981,8 +1981,8 @@ UniValue analyzepsbt(const JSONRPCRequest& request)
|
||||||
}
|
}
|
||||||
if (calc_fee) {
|
if (calc_fee) {
|
||||||
// Get the output amount
|
// Get the output amount
|
||||||
CAmount out_amt = std::accumulate(psbtx.tx->vout.begin(), psbtx.tx->vout.end(), 0,
|
CAmount out_amt = std::accumulate(psbtx.tx->vout.begin(), psbtx.tx->vout.end(), CAmount(0),
|
||||||
[](int a, const CTxOut& b) {
|
[](CAmount a, const CTxOut& b) {
|
||||||
return a += b.nValue;
|
return a += b.nValue;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue