File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
crates/transaction-pool/src Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -101,12 +101,13 @@ impl TransactionId {
101101 /// This returns `transaction_nonce - 1` if `transaction_nonce` is higher than the
102102 /// `on_chain_nonce`
103103 pub fn ancestor ( transaction_nonce : u64 , on_chain_nonce : u64 , sender : SenderId ) -> Option < Self > {
104- ( transaction_nonce > on_chain_nonce)
105- . then ( || Self :: new ( sender, transaction_nonce. saturating_sub ( 1 ) ) )
104+ // SAFETY: transaction_nonce > on_chain_nonce ⇒ transaction_nonce >= 1
105+ ( transaction_nonce > on_chain_nonce ) . then ( || Self :: new ( sender, transaction_nonce - 1 ) )
106106 }
107107
108108 /// Returns the [`TransactionId`] that would come before this transaction.
109109 pub fn unchecked_ancestor ( & self ) -> Option < Self > {
110+ // SAFETY: self.nonce != 0 ⇒ self.nonce >= 1
110111 ( self . nonce != 0 ) . then ( || Self :: new ( self . sender , self . nonce - 1 ) )
111112 }
112113
You can’t perform that action at this time.
0 commit comments