Skip to content

Commit 59b2919

Browse files
committed
Merge #15582: Fix overflow bug in analyzepsbt fee: CAmount instead of int
c9963ae 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
2 parents e577067 + c9963ae commit 59b2919

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/rpc/rawtransaction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,8 +1981,8 @@ UniValue analyzepsbt(const JSONRPCRequest& request)
19811981
}
19821982
if (calc_fee) {
19831983
// Get the output amount
1984-
CAmount out_amt = std::accumulate(psbtx.tx->vout.begin(), psbtx.tx->vout.end(), 0,
1985-
[](int a, const CTxOut& b) {
1984+
CAmount out_amt = std::accumulate(psbtx.tx->vout.begin(), psbtx.tx->vout.end(), CAmount(0),
1985+
[](CAmount a, const CTxOut& b) {
19861986
return a += b.nValue;
19871987
}
19881988
);

0 commit comments

Comments
 (0)