@@ -781,11 +781,12 @@ struct CCoinsStats
781
781
uint256 hashBlock;
782
782
uint64_t nTransactions;
783
783
uint64_t nTransactionOutputs;
784
+ uint64_t nBogoSize;
784
785
uint256 hashSerialized;
785
786
uint64_t nDiskSize;
786
787
CAmount nTotalAmount;
787
788
788
- CCoinsStats () : nHeight(0 ), nTransactions(0 ), nTransactionOutputs(0 ), nTotalAmount(0 ) {}
789
+ CCoinsStats () : nHeight(0 ), nTransactions(0 ), nTransactionOutputs(0 ), nBogoSize( 0 ), nDiskSize( 0 ), nTotalAmount(0 ) {}
789
790
};
790
791
791
792
static void ApplyStats (CCoinsStats &stats, CHashWriter& ss, const uint256& hash, const std::map<uint32_t , Coin>& outputs)
@@ -800,6 +801,8 @@ static void ApplyStats(CCoinsStats &stats, CHashWriter& ss, const uint256& hash,
800
801
ss << VARINT (output.second .out .nValue );
801
802
stats.nTransactionOutputs ++;
802
803
stats.nTotalAmount += output.second .out .nValue ;
804
+ stats.nBogoSize += 32 /* txid */ + 4 /* vout index */ + 4 /* height + coinbase */ + 8 /* amount */ +
805
+ 2 /* scriptPubKey len */ + output.second .out .scriptPubKey .size () /* scriptPubKey */ ;
803
806
}
804
807
ss << VARINT (0 );
805
808
}
@@ -904,7 +907,8 @@ UniValue gettxoutsetinfo(const JSONRPCRequest& request)
904
907
" \" bestblock\" : \" hex\" , (string) the best block hash hex\n "
905
908
" \" transactions\" : n, (numeric) The number of transactions\n "
906
909
" \" txouts\" : n, (numeric) The number of output transactions\n "
907
- " \" hash_serialized\" : \" hash\" , (string) The serialized hash\n "
910
+ " \" bogosize\" : n, (numeric) A meaningless metric for UTXO set size\n "
911
+ " \" hash_serialized_2\" : \" hash\" , (string) The serialized hash\n "
908
912
" \" disk_size\" : n, (numeric) The estimated size of the chainstate on disk\n "
909
913
" \" total_amount\" : x.xxx (numeric) The total amount\n "
910
914
" }\n "
@@ -922,6 +926,7 @@ UniValue gettxoutsetinfo(const JSONRPCRequest& request)
922
926
ret.push_back (Pair (" bestblock" , stats.hashBlock .GetHex ()));
923
927
ret.push_back (Pair (" transactions" , (int64_t )stats.nTransactions ));
924
928
ret.push_back (Pair (" txouts" , (int64_t )stats.nTransactionOutputs ));
929
+ ret.push_back (Pair (" bogosize" , (int64_t )stats.nBogoSize ));
925
930
ret.push_back (Pair (" hash_serialized_2" , stats.hashSerialized .GetHex ()));
926
931
ret.push_back (Pair (" disk_size" , stats.nDiskSize ));
927
932
ret.push_back (Pair (" total_amount" , ValueFromAmount (stats.nTotalAmount )));
0 commit comments