Browse Source

Initial implementation of shielded pool size. Tweaks to data stored in zindex are needed to get a more correct value

pull/62/head
Duke Leto 5 years ago
parent
commit
172ac60765
  1. 6
      src/rpc/blockchain.cpp
  2. 6
      src/wallet/wallet.cpp
  3. 2
      src/wallet/wallet.h

6
src/rpc/blockchain.cpp

@ -37,6 +37,7 @@
#include "script/script_error.h"
#include "script/sign.h"
#include "script/standard.h"
#include "wallet/wallet.h"
#include <stdint.h>
@ -1994,6 +1995,11 @@ UniValue getchaintxstats(const UniValue& params, bool fHelp, const CPubKey& mypk
ret.pushKV("fully_shielded_payments", (int64_t)pindex->nChainFullyShieldedPayments);
ret.pushKV("deshielding_payments", (int64_t)pindex->nChainDeshieldingPayments);
ret.pushKV("shielding_payments", (int64_t)pindex->nChainShieldingPayments);
int64_t nullifierCount = pwalletMain->NullifierCount();
//TODO: we actually need to have zindex keep track of total number of zouts, including change
// Currently zpayments does not include change and will underestimate actual zpool size
ret.pushKV("shielded_pool_size", (int64_t)pindex->nChainShieldedPayments - nullifierCount);
}
if (blockcount > 0) {

6
src/wallet/wallet.cpp

@ -960,6 +960,12 @@ void CWallet::AddToSpends(const uint256& wtxid)
}
}
int64_t CWallet::NullifierCount()
{
LOCK(cs_wallet);
return mapTxSaplingNullifiers.size();
}
void CWallet::ClearNoteWitnessCache()
{
LOCK(cs_wallet);

2
src/wallet/wallet.h

@ -796,6 +796,8 @@ public:
void ClearNoteWitnessCache();
int64_t NullifierCount();
protected:
/**
* pindex is the new tip being connected.

Loading…
Cancel
Save