File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
stackslib/src/chainstate/tests Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -414,14 +414,21 @@ impl TestTxFactory {
414414 ///
415415 /// * `tx_spec` - The original specification of the transaction whose sender's
416416 /// nonce should be incremented.
417+ ///
418+ /// # Panics
419+ ///
420+ /// Panics if the sender's address is not found in the nonce counter map.
417421 pub fn increase_nonce_for_tx ( & mut self , tx_spec : & TestTxSpec ) {
418422 let sender_privk = match tx_spec {
419423 TestTxSpec :: Transfer { from, .. } => from,
420424 TestTxSpec :: ContractDeploy { sender, .. } => sender,
421425 TestTxSpec :: ContractCall { sender, .. } => sender,
422426 } ;
423427 let address = StacksAddress :: p2pkh ( false , & StacksPublicKey :: from_private ( sender_privk) ) ;
424- let nonce = self . nonce_counter . entry ( address) . or_insert ( 0 ) ;
428+ let nonce = self
429+ . nonce_counter
430+ . get_mut ( & address)
431+ . unwrap_or_else ( || panic ! ( "Nonce not found for address {address}" ) ) ;
425432 * nonce += 1 ;
426433 }
427434
You can’t perform that action at this time.
0 commit comments