Start teaching hushd to track various stats about shielded xtns
This commit is contained in:
28
src/chain.h
28
src/chain.h
@@ -263,6 +263,29 @@ public:
|
|||||||
//! Change to 64-bit type when necessary; won't happen before 2030
|
//! Change to 64-bit type when necessary; won't happen before 2030
|
||||||
unsigned int nChainTx;
|
unsigned int nChainTx;
|
||||||
|
|
||||||
|
//! (memory only) Number of shielded transactions (of any kind) in the chain up to and including this block.
|
||||||
|
//! A shielded transaction is defined as a transaction that contains at least 1 JoinSplit, which includes
|
||||||
|
//! shielding/de-shielding and other complex transaction possibilties including multiple taddrs/zaddrs as
|
||||||
|
//! inputs and outputs.
|
||||||
|
int64_t nShieldedChainTx;
|
||||||
|
|
||||||
|
//! (memory only) Number of fully shielded transactions. A fully shielded transaction is defined
|
||||||
|
//! as a transaction containing JoinSplits and only shielded inputs and outputs
|
||||||
|
int64_t nFullyShieldedChainTx;
|
||||||
|
|
||||||
|
//! (memory only) Number of deshielding transactions. A deshielding transaction is defined
|
||||||
|
//! as a transaction containing JoinSplits and at least one transparent output.
|
||||||
|
int64_t nDeshieldingChainTx;
|
||||||
|
|
||||||
|
//! (memory only) Number of shielding transactions. A shielding transaction is defined
|
||||||
|
//! as a transaction containing JoinSplits and at least one transparent input
|
||||||
|
int64_t nShieldingChainTx;
|
||||||
|
|
||||||
|
|
||||||
|
//! (memory only) Number of shielding transactions which contain multiple shielded input notes
|
||||||
|
//! z_sendmany cannot make these and so it indicates raw shielded transaction usage currently
|
||||||
|
int64_t nMultipleShieldedInputsChainTx;
|
||||||
|
|
||||||
//! Verification status of this block. See enum BlockStatus
|
//! Verification status of this block. See enum BlockStatus
|
||||||
unsigned int nStatus;
|
unsigned int nStatus;
|
||||||
|
|
||||||
@@ -321,6 +344,11 @@ public:
|
|||||||
chainPower = CChainPower();
|
chainPower = CChainPower();
|
||||||
nTx = 0;
|
nTx = 0;
|
||||||
nChainTx = 0;
|
nChainTx = 0;
|
||||||
|
nShieldedChainTx = 0;
|
||||||
|
nShieldingChainTx = 0;
|
||||||
|
nDeshieldingChainTx = 0;
|
||||||
|
nFullyShieldedChainTx = 0;
|
||||||
|
nMultipleShieldedInputsChainTx = 0;
|
||||||
nStatus = 0;
|
nStatus = 0;
|
||||||
nCachedBranchId = boost::none;
|
nCachedBranchId = boost::none;
|
||||||
hashSproutAnchor = uint256();
|
hashSproutAnchor = uint256();
|
||||||
|
|||||||
@@ -4734,6 +4734,11 @@ bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBl
|
|||||||
while (!queue.empty()) {
|
while (!queue.empty()) {
|
||||||
CBlockIndex *pindex = queue.front();
|
CBlockIndex *pindex = queue.front();
|
||||||
queue.pop_front();
|
queue.pop_front();
|
||||||
|
// TODO: Count zxtns properly, even amount=0 xtns
|
||||||
|
// TODO: count number of joinsplits instead
|
||||||
|
if(saplingValue>0) {
|
||||||
|
pindex->nShieldedChainTx = pindex->nShieldedChainTx ? 0 : pindex->nShieldedChainTx + 1;
|
||||||
|
}
|
||||||
pindex->nChainTx = (pindex->pprev ? pindex->pprev->nChainTx : 0) + pindex->nTx;
|
pindex->nChainTx = (pindex->pprev ? pindex->pprev->nChainTx : 0) + pindex->nTx;
|
||||||
if (pindex->pprev) {
|
if (pindex->pprev) {
|
||||||
if (pindex->pprev->nChainSproutValue && pindex->nSproutValue) {
|
if (pindex->pprev->nChainSproutValue && pindex->nSproutValue) {
|
||||||
|
|||||||
Reference in New Issue
Block a user