Split JoinSplit proof verification out of CheckTransaction.
This commit is contained in:
27
src/main.cpp
27
src/main.cpp
@@ -870,8 +870,23 @@ crypto_sign_check_S_lt_l(const unsigned char *S)
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool CheckTransaction(const CTransaction& tx, CValidationState &state)
|
||||
{
|
||||
if (!CheckTransactionWithoutProofVerification(tx, state)) {
|
||||
return false;
|
||||
} else {
|
||||
// Ensure that zk-SNARKs verify
|
||||
BOOST_FOREACH(const CPourTx &pour, tx.vpour) {
|
||||
if (!pour.Verify(*pzcashParams, tx.joinSplitPubKey)) {
|
||||
return state.DoS(100, error("CheckTransaction(): pour does not verify"),
|
||||
REJECT_INVALID, "bad-txns-pour-verification-failed");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidationState &state)
|
||||
{
|
||||
// Basic checks that don't depend on any context
|
||||
|
||||
@@ -1008,16 +1023,6 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state)
|
||||
return state.DoS(100, error("CheckTransaction(): non-canonical ed25519 signature"),
|
||||
REJECT_INVALID, "non-canonical-ed25519-signature");
|
||||
}
|
||||
|
||||
if (state.PerformPourVerification()) {
|
||||
// Ensure that zk-SNARKs verify
|
||||
BOOST_FOREACH(const CPourTx &pour, tx.vpour) {
|
||||
if (!pour.Verify(*pzcashParams, tx.joinSplitPubKey)) {
|
||||
return state.DoS(100, error("CheckTransaction(): pour does not verify"),
|
||||
REJECT_INVALID, "bad-txns-pour-verification-failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user