diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-11-01 17:03:09 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-12-17 10:47:31 +0100 |
commit | fa996c58e8a31ebe610d186cef408b6dd3b385a8 (patch) | |
tree | db5a678ba2b97fa080446d10247a92c9cc426895 /src/rpc/blockchain.cpp | |
parent | fac01888d17423d6c23a9ce15d98fc88fb34e3cc (diff) | |
download | bitcoin-fa996c58e8a31ebe610d186cef408b6dd3b385a8.tar.xz |
refactor: Avoid integer overflow in ApplyStats when activating snapshot
Diffstat (limited to 'src/rpc/blockchain.cpp')
-rw-r--r-- | src/rpc/blockchain.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 689c8751f3..f6112e78e0 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1244,7 +1244,8 @@ static RPCHelpMan gettxoutsetinfo() if (hash_type == CoinStatsHashType::MUHASH) { ret.pushKV("muhash", stats.hashSerialized.GetHex()); } - ret.pushKV("total_amount", ValueFromAmount(stats.nTotalAmount)); + CHECK_NONFATAL(stats.total_amount.has_value()); + ret.pushKV("total_amount", ValueFromAmount(stats.total_amount.value())); if (!stats.index_used) { ret.pushKV("transactions", static_cast<int64_t>(stats.nTransactions)); ret.pushKV("disk_size", stats.nDiskSize); |