Enable ZIP 216 for blocks prior to NU5 activation

This commit is contained in:
Sean Bowe 2022-06-08 08:03:47 -06:00 committed by Kris Nuttycombe
parent 6c51df37b4
commit 458e773792
2 changed files with 7 additions and 9 deletions

View File

@ -1318,12 +1318,7 @@ bool ContextualCheckShieldedInputs(
if (!tx.vShieldedSpend.empty() ||
!tx.vShieldedOutput.empty())
{
// The nu5Active flag passed in here enables the new consensus rules from ZIP 216
// (https://zips.z.cash/zip-0216#specification) on the following fields:
//
// - spendAuthSig in Sapling Spend descriptions
// - bindingSigSapling
auto ctx = sapling::init_verifier(nu5Active);
auto ctx = sapling::init_verifier();
for (const SpendDescription &spend : tx.vShieldedSpend) {
if (!ctx->check_spend(

View File

@ -23,7 +23,7 @@ mod ffi {
extern "Rust" {
type Verifier;
fn init_verifier(zip216_enabled: bool) -> Box<Verifier>;
fn init_verifier() -> Box<Verifier>;
fn check_spend(
&mut self,
cv: &[u8; 32],
@ -52,8 +52,11 @@ mod ffi {
struct Verifier(SaplingVerificationContext);
fn init_verifier(zip216_enabled: bool) -> Box<Verifier> {
Box::new(Verifier(SaplingVerificationContext::new(zip216_enabled)))
fn init_verifier() -> Box<Verifier> {
// We consider ZIP 216 active all of the time because blocks prior to NU5
// activation (on mainnet and testnet) did not contain Sapling transactions
// that violated its canonicity rule.
Box::new(Verifier(SaplingVerificationContext::new(true)))
}
impl Verifier {