From 9ad1a518574b9afed3e66a1e1658ead1d3d7ce54 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sat, 9 Apr 2016 07:39:35 +0200 Subject: crypto: bytes counts are 64 bit Byte counts for SHA256, SHA512, SHA1 and RIPEMD160 must be 64 bits. `size_t` has a different size per platform, causing divergent results when hashing more than 4GB of data. --- src/crypto/ripemd160.h | 2 +- src/crypto/sha1.h | 2 +- src/crypto/sha256.h | 2 +- src/crypto/sha512.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/crypto/ripemd160.h b/src/crypto/ripemd160.h index 687204fdae..bd41f02508 100644 --- a/src/crypto/ripemd160.h +++ b/src/crypto/ripemd160.h @@ -14,7 +14,7 @@ class CRIPEMD160 private: uint32_t s[5]; unsigned char buf[64]; - size_t bytes; + uint64_t bytes; public: static const size_t OUTPUT_SIZE = 20; diff --git a/src/crypto/sha1.h b/src/crypto/sha1.h index 7b2a21bc6c..8fb20810be 100644 --- a/src/crypto/sha1.h +++ b/src/crypto/sha1.h @@ -14,7 +14,7 @@ class CSHA1 private: uint32_t s[5]; unsigned char buf[64]; - size_t bytes; + uint64_t bytes; public: static const size_t OUTPUT_SIZE = 20; diff --git a/src/crypto/sha256.h b/src/crypto/sha256.h index 85cf33739a..5b15b6a233 100644 --- a/src/crypto/sha256.h +++ b/src/crypto/sha256.h @@ -14,7 +14,7 @@ class CSHA256 private: uint32_t s[8]; unsigned char buf[64]; - size_t bytes; + uint64_t bytes; public: static const size_t OUTPUT_SIZE = 32; diff --git a/src/crypto/sha512.h b/src/crypto/sha512.h index f1f17caf90..614681fae2 100644 --- a/src/crypto/sha512.h +++ b/src/crypto/sha512.h @@ -14,7 +14,7 @@ class CSHA512 private: uint64_t s[8]; unsigned char buf[128]; - size_t bytes; + uint64_t bytes; public: static const size_t OUTPUT_SIZE = 64; -- cgit v1.2.3 From 76212bbc6a13298d7154ac16c0b989aca5471de8 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sat, 9 Apr 2016 07:59:49 +0200 Subject: rpc: make sure `gettxoutsetinfo` hash has txids The key (transaction id for the following outputs) should be serialized to the HashWriter. This is a problem as it means different transactions in the same position with the same outputs will potentially result in the same hash. Fixes primary concern of #7758. --- src/rpc/blockchain.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index b85b2f6b57..88f6278b2a 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -467,6 +467,7 @@ static bool GetUTXOStats(CCoinsView *view, CCoinsStats &stats) CCoins coins; if (pcursor->GetKey(key) && pcursor->GetValue(coins)) { stats.nTransactions++; + ss << key; for (unsigned int i=0; i Date: Fri, 15 Apr 2016 17:54:45 +0200 Subject: doc: update release-notes for `gettxoutsetinfo` change --- doc/release-notes.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/release-notes.md b/doc/release-notes.md index 806d174ebf..8360cc4816 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -21,6 +21,13 @@ It is recommended to use this for sensitive information such as wallet passphrases, as command-line arguments can usually be read from the process table by any user on the system. +RPC low-level changes +---------------------- + +- `gettxoutsetinfo` UTXO hash (`hash_serialized`) has changed. There was a divergence between + 32-bit and 64-bit platforms, and the txids were missing in the hashed data. This has been + fixed, but this means that the output will be different than from previous versions. + 0.13.0 Change log ================= -- cgit v1.2.3