hijack secp256k1 enablement feature plumbing for libsecp256k1 upgrade

This commit is contained in:
Trent Nelson
2021-07-13 17:10:30 -06:00
committed by mergify[bot]
parent 568660b402
commit 3a85b77bb5
14 changed files with 75 additions and 103 deletions

View File

@@ -359,7 +359,7 @@ pub trait EntrySlice {
fn verify_and_hash_transactions(
&self,
skip_verification: bool,
secp256k1_program_enabled: bool,
libsecp256k1_0_5_upgrade_enabled: bool,
verify_tx_signatures_len: bool,
) -> Option<Vec<EntryType<'_>>>;
}
@@ -515,7 +515,7 @@ impl EntrySlice for [Entry] {
fn verify_and_hash_transactions<'a>(
&'a self,
skip_verification: bool,
secp256k1_program_enabled: bool,
libsecp256k1_0_5_upgrade_enabled: bool,
verify_tx_signatures_len: bool,
) -> Option<Vec<EntryType<'a>>> {
let verify_and_hash = |tx: &'a Transaction| -> Option<HashedTransaction<'a>> {
@@ -524,10 +524,8 @@ impl EntrySlice for [Entry] {
if size > PACKET_DATA_SIZE as u64 {
return None;
}
if secp256k1_program_enabled {
// Verify tx precompiles if secp256k1 program is enabled.
tx.verify_precompiles().ok()?;
}
tx.verify_precompiles(libsecp256k1_0_5_upgrade_enabled)
.ok()?;
if verify_tx_signatures_len && !tx.verify_signatures_len() {
return None;
}