Correct various stats and add block height to response
This commit is contained in:
15
src/main.cpp
15
src/main.cpp
@@ -4796,11 +4796,9 @@ bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBl
|
|||||||
nShieldedTx++;
|
nShieldedTx++;
|
||||||
if(tx.vin.size()==0 && tx.vout.size()==0) {
|
if(tx.vin.size()==0 && tx.vout.size()==0) {
|
||||||
nFullyShieldedTx++;
|
nFullyShieldedTx++;
|
||||||
}
|
} else if(tx.vin.size()>0) {
|
||||||
if(tx.vin.size()>0) {
|
|
||||||
nShieldingTx++;
|
nShieldingTx++;
|
||||||
}
|
} else if(tx.vout.size()>0) {
|
||||||
if(tx.vout.size()>0) {
|
|
||||||
nDeshieldingTx++;
|
nDeshieldingTx++;
|
||||||
}
|
}
|
||||||
//NOTE: These are at best heuristics. Improve them as much as possible
|
//NOTE: These are at best heuristics. Improve them as much as possible
|
||||||
@@ -4819,8 +4817,13 @@ bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBl
|
|||||||
// z->(z,z,z) = 2 shielded payments + shielded change
|
// z->(z,z,z) = 2 shielded payments + shielded change
|
||||||
// Assume that there is always 1 change output when there are more than one
|
// Assume that there is always 1 change output when there are more than one
|
||||||
nShieldedPayments += nShieldedOutputs > 1 ? (nShieldedOutputs-1) : 1;
|
nShieldedPayments += nShieldedOutputs > 1 ? (nShieldedOutputs-1) : 1;
|
||||||
// TODO: fully shielded should not count toward shielding/deshielding
|
|
||||||
nShieldingPayments += nShieldedOutputs > 1 ? (nShieldedOutputs-1) : 1;
|
// Fully shielded do not count toward shielding/deshielding
|
||||||
|
if(tx.vin.size()==0 && tx.vout.size()==0) {
|
||||||
|
nFullyShieldedPayments += nShieldedOutputs > 1 ? (nShieldedOutputs-1) : 1;
|
||||||
|
} else {
|
||||||
|
nShieldingPayments += nShieldedOutputs > 1 ? (nShieldedOutputs-1) : 1;
|
||||||
|
}
|
||||||
} else if (nShieldedSpends >=1) {
|
} else if (nShieldedSpends >=1) {
|
||||||
// Shielded inputs with no shielded outputs. We know none are change output because
|
// Shielded inputs with no shielded outputs. We know none are change output because
|
||||||
// change would flow back to the zaddr
|
// change would flow back to the zaddr
|
||||||
|
|||||||
@@ -2017,6 +2017,7 @@ UniValue getchaintxstats(const UniValue& params, bool fHelp)
|
|||||||
ret.pushKV("shielding_payments", (int64_t)pindex->nChainShieldingPayments);
|
ret.pushKV("shielding_payments", (int64_t)pindex->nChainShieldingPayments);
|
||||||
|
|
||||||
ret.pushKV("window_final_block_hash", pindex->GetBlockHash().GetHex());
|
ret.pushKV("window_final_block_hash", pindex->GetBlockHash().GetHex());
|
||||||
|
ret.pushKV("window_final_block_height", pindex->GetHeight());
|
||||||
ret.pushKV("window_block_count", blockcount);
|
ret.pushKV("window_block_count", blockcount);
|
||||||
|
|
||||||
if (blockcount > 0) {
|
if (blockcount > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user