Skip to content

Commit c9963ae

Browse files
committed
Fix overflow bug in analyzepsbt fee: CAmount instead of int
1 parent c94852e commit c9963ae

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)