Reject transactions with extra signatures (#18306)

* Reject transactions with extra signatures

* fix tests

* fix check

* fix check

* tx method

* fix checks
This commit is contained in:
Justin Starry
2021-07-01 13:06:59 -05:00
committed by GitHub
parent 45d54b1fc6
commit d5961e9d9f
7 changed files with 97 additions and 5 deletions

View File

@ -147,6 +147,10 @@ pub mod dedupe_config_program_signers {
solana_sdk::declare_id!("8kEuAshXLsgkUEdcFVLqrjCGGHVWFW99ZZpxvAzzMtBp");
}
pub mod verify_tx_signatures_len {
solana_sdk::declare_id!("EVW9B5xD9FFK7vw1SBARwMA4s5eRo5eKJdKpsBikzKBz");
}
lazy_static! {
/// Map of feature identifiers to user-visible description
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [

View File

@ -361,6 +361,11 @@ impl Transaction {
}
}
/// Verify the length of signatures matches the value in the message header
pub fn verify_signatures_len(&self) -> bool {
self.signatures.len() == self.message.header.num_required_signatures as usize
}
/// Verify the transaction and hash its message
pub fn verify_and_hash_message(&self) -> Result<Hash> {
let message_bytes = self.message_data();