diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2019-03-12 12:25:19 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2019-03-12 12:31:08 +0100 |
commit | 59b291966eb6ac5e668aaebe563b762edbcd272d (patch) | |
tree | 5b6a9046b2bb8e2ab7d55b821f3d24f2af318d97 | |
parent | e5770677de850624c600983adba650301c3299d0 (diff) | |
parent | c9963ae8b1a4d26d19c58e18fde9c85783edb788 (diff) | |
download | bitcoin-59b291966eb6ac5e668aaebe563b762edbcd272d.tar.xz |
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
-rw-r--r-- | src/rpc/rawtransaction.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index d19afaa8a1..3da7661638 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -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; } ); |