@@ -96,9 +96,11 @@ pub enum Error {
9696 #[ error( "borsh serialization error" ) ]
9797 BorshSerialize ( #[ from] borsh:: io:: Error ) ,
9898 #[ error( "ed25519_dalek error" ) ]
99- DalekError ( #[ from] SignatureError ) ,
100- #[ error( "bincode error" ) ]
101- BincodeError ( #[ from] bincode:: Error ) ,
99+ Dalek ( #[ from] SignatureError ) ,
100+ #[ error( "not enough authorizations" ) ]
101+ NotEnoughAuthorizations ,
102+ #[ error( "too many authorizations" ) ]
103+ TooManyAuthorizations ,
102104 #[ error(
103105 "wrong key for address: address = {address},
104106 hash(verifying_key) = {hash_verifying_key}"
@@ -170,6 +172,14 @@ fn tx_msg_canonical(tx: &Transaction) -> borsh::io::Result<Vec<u8>> {
170172pub fn verify_authorized_transaction (
171173 transaction : & AuthorizedTransaction ,
172174) -> Result < ( ) , Error > {
175+ let verifications_required = & transaction. transaction . inputs . len ( ) ;
176+ match transaction. authorizations . len ( ) . cmp ( verifications_required) {
177+ std:: cmp:: Ordering :: Less => return Err ( Error :: NotEnoughAuthorizations ) ,
178+ std:: cmp:: Ordering :: Equal => ( ) ,
179+ std:: cmp:: Ordering :: Greater => {
180+ return Err ( Error :: TooManyAuthorizations ) ;
181+ }
182+ }
173183 let tx_msg_canonical = tx_msg_canonical ( & transaction. transaction ) ?;
174184 let messages: Vec < _ > = std:: iter:: repeat_n (
175185 tx_msg_canonical. as_slice ( ) ,
0 commit comments