Fix overflow bug in analyzepsbt fee: CAmount instead of int
Github-Pull: #15582 Rebased-From: c9963ae8b1a4d26d19c58e18fde9c85783edb788 Tree-SHA512: ed1dcfafb7015de5405112938b04c4009bec3349a8d4e8aca641598ccab31a34c7f16b5045670909fd2e795fc40640a79658ef6b1771e9f21abd0ca759b239b5
This commit is contained in:
committed by
Wladimir J. van der Laan
parent
2edd0c40c3
commit
232ef630ec
@@ -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;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user