aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/blockchain.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-11-01 17:03:09 +0100
committerMarcoFalke <falke.marco@gmail.com>2021-12-17 10:47:31 +0100
commitfa996c58e8a31ebe610d186cef408b6dd3b385a8 (patch)
treedb5a678ba2b97fa080446d10247a92c9cc426895 /src/rpc/blockchain.cpp
parentfac01888d17423d6c23a9ce15d98fc88fb34e3cc (diff)
downloadbitcoin-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.cpp3
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);