@@ -39,8 +39,8 @@ impl Signer {
3939 ) )
4040 }
4141
42- async fn get_sequential_nonce ( & self , key : TransactionGroupKey ) -> Arc < Mutex < u64 > > {
43- self . sequential_nonces
42+ async fn get_nonce_cache ( & self , key : TransactionGroupKey ) -> Arc < Mutex < u64 > > {
43+ self . nonce_cache
4444 . lock ( )
4545 . await
4646 . entry ( key)
@@ -67,14 +67,14 @@ impl Signer {
6767 debug ! ( target: SIGNER_TARGET , "Fetching transaction nonce" ) ;
6868
6969 let key = ( network. network_name . clone ( ) , account_id. clone ( ) , public_key) ;
70- let lock = self . get_sequential_nonce ( key) . await ;
70+ let lock = self . get_nonce_cache ( key) . await ;
7171 let mut nonce = lock. lock ( ) . await ;
7272
7373 // It is important to fetch the nonce data after lock to get fresh block hash
74- let ( cached_nonce , block_hash, block_height) =
74+ let ( fetched_nonce , block_hash, block_height) =
7575 Self :: fetch_nonce_data ( account_id, public_key, network) . await ?;
7676
77- * nonce = ( * nonce) . max ( cached_nonce ) + 1 ;
77+ * nonce = ( * nonce) . max ( fetched_nonce ) + 1 ;
7878
7979 Ok ( ( * nonce, block_hash, block_height) )
8080 }
@@ -109,7 +109,7 @@ impl Signer {
109109 . await ?;
110110
111111 match wait_until {
112- TxExecutionStatus :: Included => Ok ( result) ,
112+ TxExecutionStatus :: None | TxExecutionStatus :: Included => Ok ( result) ,
113113 _ => {
114114 ExecuteSignedTransaction :: fetch_tx (
115115 network,
@@ -163,15 +163,16 @@ impl Signer {
163163
164164 // Locking until the transaction is sent
165165 let key = ( network. network_name . clone ( ) , account_id. clone ( ) , public_key) ;
166- let lock = self . get_sequential_nonce ( key) . await ;
166+ let lock = self . get_nonce_cache ( key) . await ;
167167 let mut nonce = lock. lock ( ) . await ;
168168
169169 // It is important to fetch the nonce data after lock to get fresh block hash
170- let ( cached_nonce, block_hash, _) = Self :: fetch_nonce_data ( account_id, public_key, network)
171- . await
172- . map_err ( MetaSignError :: from) ?;
170+ let ( fetched_nonce, block_hash, _) =
171+ Self :: fetch_nonce_data ( account_id, public_key, network)
172+ . await
173+ . map_err ( MetaSignError :: from) ?;
173174
174- * nonce = ( * nonce) . max ( cached_nonce ) + 1 ;
175+ * nonce = ( * nonce) . max ( fetched_nonce ) + 1 ;
175176
176177 let signed = self
177178 . sign ( transaction, public_key, * nonce, block_hash)
@@ -198,16 +199,16 @@ impl Signer {
198199
199200 // Locking until the transaction is sent
200201 let key = ( network. network_name . clone ( ) , account_id. clone ( ) , public_key) ;
201- let lock = self . get_sequential_nonce ( key) . await ;
202+ let lock = self . get_nonce_cache ( key) . await ;
202203 let mut nonce = lock. lock ( ) . await ;
203204
204205 // It is important to fetch the nonce data after lock to get fresh block hash
205- let ( cached_nonce , block_hash, block_height) =
206+ let ( fetched_nonce , block_hash, block_height) =
206207 Self :: fetch_nonce_data ( account_id, public_key, network)
207208 . await
208209 . map_err ( MetaSignError :: from) ?;
209210
210- * nonce = ( * nonce) . max ( cached_nonce ) + 1 ;
211+ * nonce = ( * nonce) . max ( fetched_nonce ) + 1 ;
211212
212213 let signed = self
213214 . sign_meta (
0 commit comments