From 34ca75032012562d226b06ef9e86a2948d3a8d16 Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Tue, 20 Mar 2018 13:07:17 -0400 Subject: [PATCH] Remove unnecessary NONNEGATIVE_SIGNED Switch to unsigned encoding, which is backwards compatible and avoids MSVC error reported https://github.com/bitcoin/bitcoin/issues/12732 --- src/rpc/blockchain.cpp | 2 +- src/undo.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 3f66c0c53..169caddc5 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -834,7 +834,7 @@ static void ApplyStats(CCoinsStats &stats, CHashWriter& ss, const uint256& hash, { assert(!outputs.empty()); ss << hash; - ss << VARINT(outputs.begin()->second.nHeight * 2 + outputs.begin()->second.fCoinBase, VarIntMode::NONNEGATIVE_SIGNED); + ss << VARINT(outputs.begin()->second.nHeight * 2 + outputs.begin()->second.fCoinBase ? 1u : 0u); stats.nTransactions++; for (const auto output : outputs) { ss << VARINT(output.first + 1); diff --git a/src/undo.h b/src/undo.h index 6fc25b985..9f39299fb 100644 --- a/src/undo.h +++ b/src/undo.h @@ -25,7 +25,7 @@ class TxInUndoSerializer public: template void Serialize(Stream &s) const { - ::Serialize(s, VARINT(txout->nHeight * 2 + (txout->fCoinBase ? 1 : 0), VarIntMode::NONNEGATIVE_SIGNED)); + ::Serialize(s, VARINT(txout->nHeight * 2 + (txout->fCoinBase ? 1u : 0u))); if (txout->nHeight > 0) { // Required to maintain compatibility with older undo format. ::Serialize(s, (unsigned char)0);