diff options
| author | Wladimir J. van der Laan <[email protected]> | 2019-03-12 12:25:19 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2019-03-12 12:31:08 +0100 |
| commit | 59b291966eb6ac5e668aaebe563b762edbcd272d (patch) | |
| tree | 5b6a9046b2bb8e2ab7d55b821f3d24f2af318d97 /src | |
| parent | Merge #15548: build: use full version string in setup.exe (diff) | |
| parent | Fix overflow bug in analyzepsbt fee: CAmount instead of int (diff) | |
| download | discoin-59b291966eb6ac5e668aaebe563b762edbcd272d.tar.xz discoin-59b291966eb6ac5e668aaebe563b762edbcd272d.zip | |
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
Diffstat (limited to 'src')
| -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 d19afaa8a..3da766163 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; } ); |