@@ -2580,6 +2580,13 @@ def undictify(d):
25802580 lsig .lmsig = Multisig .undictify (d ["lmsig" ])
25812581 return lsig
25822582
2583+ def sig_count (self ):
2584+ return (
2585+ int (self .sig is not None )
2586+ + int (self .msig is not None )
2587+ + int (self .lmsig is not None )
2588+ )
2589+
25832590 def verify (self , public_key ):
25842591 """
25852592 Verifies LogicSig against the transaction's sender address
@@ -2597,9 +2604,10 @@ def verify(self, public_key):
25972604 except error .InvalidProgram :
25982605 return False
25992606
2607+ if self .sig_count () > 1 :
2608+ return False
2609+
26002610 if self .sig :
2601- if self .msig or self .lmsig :
2602- return False
26032611 verify_key = VerifyKey (public_key )
26042612 try :
26052613 to_sign = constants .logic_prefix + self .logic
@@ -2609,14 +2617,10 @@ def verify(self, public_key):
26092617 return False
26102618
26112619 if self .msig :
2612- if self .sig or self .lmsig :
2613- return False
26142620 to_sign = constants .logic_prefix + self .logic
26152621 return self .msig .verify (to_sign )
26162622
26172623 if self .lmsig :
2618- if self .sig or self .msig :
2619- return False
26202624 to_sign = (
26212625 constants .multisig_logic_prefix
26222626 + self .lmsig .address_bytes ()
@@ -2790,6 +2794,15 @@ def verify(self) -> bool:
27902794 addr = self .address ()
27912795 return self .lsig .verify (encoding .decode_address (addr ))
27922796
2797+ def sig_count (self ) -> int :
2798+ """
2799+ Returns the number of cryptographic signatures on the LogicSig
2800+
2801+ Returns:
2802+ int: The number of signatures. Should never exceed 1.
2803+ """
2804+ return self .lsig .sig_count ()
2805+
27932806 def address (self ) -> str :
27942807 """
27952808 Get the address of this LogicSigAccount.
@@ -2800,6 +2813,9 @@ def address(self) -> str:
28002813 If the LogicSig is not delegated to another account, this will return an
28012814 escrow address that is the hash of the LogicSig's program code.
28022815 """
2816+ if self .sig_count () > 1 :
2817+ raise error .LogicSigOverspecifiedSignature
2818+
28032819 if self .lsig .sig :
28042820 if not self .sigkey :
28052821 raise error .LogicSigSigningKeyMissing
0 commit comments