Shielding+deshielding payments in z-only section

This commit is contained in:
Jonathan "Duke" Leto
2019-08-17 22:08:17 -07:00
parent 80b1479184
commit 3f94feb836

View File

@@ -4819,6 +4819,8 @@ 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;
} 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
@@ -4826,6 +4828,7 @@ bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBl
// z->(t,t) = 2 shielded payments // z->(t,t) = 2 shielded payments
// z->(t,t,t) = 3 shielded payments // z->(t,t,t) = 3 shielded payments
nShieldedPayments += tx.vout.size(); nShieldedPayments += tx.vout.size();
nDeshieldingPayments += tx.vout.size() > 1 ? tx.vout.size()-1 : tx.vout.size();
} }
//TODO: correctly add shielded payments to total chain payments //TODO: correctly add shielded payments to total chain payments
nPayments += nShieldedPayments; nPayments += nShieldedPayments;