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.
This commit is contained in:
Wladimir J. van der Laan 2016-04-09 07:59:49 +02:00
parent 9ad1a51857
commit 76212bbc6a

View file

@ -467,6 +467,7 @@ static bool GetUTXOStats(CCoinsView *view, CCoinsStats &stats)
CCoins coins; CCoins coins;
if (pcursor->GetKey(key) && pcursor->GetValue(coins)) { if (pcursor->GetKey(key) && pcursor->GetValue(coins)) {
stats.nTransactions++; stats.nTransactions++;
ss << key;
for (unsigned int i=0; i<coins.vout.size(); i++) { for (unsigned int i=0; i<coins.vout.size(); i++) {
const CTxOut &out = coins.vout[i]; const CTxOut &out = coins.vout[i];
if (!out.IsNull()) { if (!out.IsNull()) {