@@ -782,6 +782,7 @@ struct CCoinsStats
782782 uint64_t nTransactions;
783783 uint64_t nTransactionOutputs;
784784 uint256 hashSerialized;
785+ uint64_t nDiskSize;
785786 CAmount nTotalAmount;
786787
787788 CCoinsStats () : nHeight(0 ), nTransactions(0 ), nTransactionOutputs(0 ), nTotalAmount(0 ) {}
@@ -826,6 +827,7 @@ static bool GetUTXOStats(CCoinsView *view, CCoinsStats &stats)
826827 }
827828 stats.hashSerialized = ss.GetHash ();
828829 stats.nTotalAmount = nTotalAmount;
830+ stats.nDiskSize = view->EstimateSize ();
829831 return true ;
830832}
831833
@@ -892,6 +894,7 @@ UniValue gettxoutsetinfo(const JSONRPCRequest& request)
892894 " \" transactions\" : n, (numeric) The number of transactions\n "
893895 " \" txouts\" : n, (numeric) The number of output transactions\n "
894896 " \" hash_serialized\" : \" hash\" , (string) The serialized hash\n "
897+ " \" disk_size\" : n, (numeric) The estimated size of the chainstate on disk\n "
895898 " \" total_amount\" : x.xxx (numeric) The total amount\n "
896899 " }\n "
897900 " \n Examples:\n "
@@ -909,6 +912,7 @@ UniValue gettxoutsetinfo(const JSONRPCRequest& request)
909912 ret.push_back (Pair (" transactions" , (int64_t )stats.nTransactions ));
910913 ret.push_back (Pair (" txouts" , (int64_t )stats.nTransactionOutputs ));
911914 ret.push_back (Pair (" hash_serialized_2" , stats.hashSerialized .GetHex ()));
915+ ret.push_back (Pair (" disk_size" , stats.nDiskSize ));
912916 ret.push_back (Pair (" total_amount" , ValueFromAmount (stats.nTotalAmount )));
913917 } else {
914918 throw JSONRPCError (RPC_INTERNAL_ERROR, " Unable to read UTXO set" );
0 commit comments