@@ -561,32 +561,25 @@ where
561561 ) ) ;
562562 }
563563
564- let ( message, blockhash) =
565- if let ( Some ( nonce_account) , Some ( nonce_authority) , Some ( nonce_blockhash) ) = (
566- self . nonce_account ,
567- & self . nonce_authority ,
568- self . nonce_blockhash ,
569- ) {
570- let mut message = Message :: new_with_nonce (
571- token_instructions. to_vec ( ) ,
572- fee_payer,
573- & nonce_account,
574- & nonce_authority. pubkey ( ) ,
575- ) ;
576- message. recent_blockhash = nonce_blockhash;
577- ( message, nonce_blockhash)
578- } else {
579- let latest_blockhash = self
580- . client
581- . get_latest_blockhash ( )
582- . await
583- . map_err ( TokenError :: Client ) ?;
584- (
585- Message :: new_with_blockhash ( & instructions, fee_payer, & latest_blockhash) ,
586- latest_blockhash,
587- )
588- } ;
564+ let blockhash = if let ( Some ( nonce_account) , Some ( nonce_authority) , Some ( nonce_blockhash) ) = (
565+ self . nonce_account ,
566+ & self . nonce_authority ,
567+ self . nonce_blockhash ,
568+ ) {
569+ let nonce_instruction = system_instruction:: advance_nonce_account (
570+ & nonce_account,
571+ & nonce_authority. pubkey ( ) ,
572+ ) ;
573+ instructions. insert ( 0 , nonce_instruction) ;
574+ nonce_blockhash
575+ } else {
576+ self . client
577+ . get_latest_blockhash ( )
578+ . await
579+ . map_err ( TokenError :: Client ) ?
580+ } ;
589581
582+ let message = Message :: new_with_blockhash ( & instructions, fee_payer, & blockhash) ;
590583 let mut transaction = Transaction :: new_unsigned ( message) ;
591584 let signing_pubkeys = signing_keypairs. pubkeys ( ) ;
592585
0 commit comments