@@ -471,18 +471,27 @@ impl OmniConnector {
471471 transaction_options : TransactionOptions ,
472472 ) -> Result < CryptoHash > {
473473 let utxo_bridge_client = self . utxo_bridge_client ( chain) ?;
474+ let near_bridge_client = self . near_bridge_client ( ) ?;
475+
474476 let proof_data = utxo_bridge_client. extract_btc_proof ( & tx_hash) . await ?;
475477
476478 let light_client = self . light_client ( chain) ?;
477479 let light_client_last_block = light_client. get_last_block_number ( ) . await ?;
478480
479- if proof_data. block_height > light_client_last_block {
481+ let amount = near_bridge_client
482+ . get_btc_pending_info ( chain, tx_hash. clone ( ) )
483+ . await ?
484+ . transfer_amount ;
485+ let confirmations = near_bridge_client
486+ . get_total_confirmations ( chain, amount)
487+ . await ?;
488+
489+ if proof_data. block_height + u64:: from ( confirmations) > light_client_last_block {
480490 return Err ( BridgeSdkError :: LightClientNotSynced (
481491 light_client_last_block,
482492 ) ) ;
483493 }
484494
485- let near_bridge_client = self . near_bridge_client ( ) ?;
486495 let deposit_msg = match deposit_args {
487496 BtcDepositArgs :: DepositMsg { msg } => msg,
488497 BtcDepositArgs :: OmniDepositArgs { recipient_id, fee } => {
@@ -511,18 +520,27 @@ impl OmniConnector {
511520 transaction_options : TransactionOptions ,
512521 ) -> Result < CryptoHash > {
513522 let utxo_bridge_client = self . utxo_bridge_client ( chain) ?;
523+ let near_bridge_client = self . near_bridge_client ( ) ?;
524+
514525 let proof_data = utxo_bridge_client. extract_btc_proof ( & tx_hash) . await ?;
515526
516527 let light_client = self . light_client ( chain) ?;
517528 let light_client_last_block = light_client. get_last_block_number ( ) . await ?;
518529
519- if proof_data. block_height > light_client_last_block {
530+ let amount = near_bridge_client
531+ . get_btc_pending_info ( chain, tx_hash. clone ( ) )
532+ . await ?
533+ . transfer_amount ;
534+ let confirmations = near_bridge_client
535+ . get_total_confirmations ( chain, amount)
536+ . await ?;
537+
538+ if proof_data. block_height + u64:: from ( confirmations) > light_client_last_block {
520539 return Err ( BridgeSdkError :: LightClientNotSynced (
521540 light_client_last_block,
522541 ) ) ;
523542 }
524543
525- let near_bridge_client = self . near_bridge_client ( ) ?;
526544 let args = BtcVerifyWithdrawArgs {
527545 tx_id : tx_hash,
528546 tx_block_blockhash : proof_data. tx_block_blockhash ,
@@ -555,18 +573,27 @@ impl OmniConnector {
555573 transaction_options : TransactionOptions ,
556574 ) -> Result < CryptoHash > {
557575 let utxo_bridge_client = self . utxo_bridge_client ( chain) ?;
576+ let near_bridge_client = self . near_bridge_client ( ) ?;
577+
558578 let proof_data = utxo_bridge_client. extract_btc_proof ( & tx_hash) . await ?;
559579
560580 let light_client = self . light_client ( chain) ?;
561581 let light_client_last_block = light_client. get_last_block_number ( ) . await ?;
562582
563- if proof_data. block_height > light_client_last_block {
583+ let amount = near_bridge_client
584+ . get_btc_pending_info ( chain, tx_hash. clone ( ) )
585+ . await ?
586+ . transfer_amount ;
587+ let confirmations = near_bridge_client
588+ . get_total_confirmations ( chain, amount)
589+ . await ?;
590+
591+ if proof_data. block_height + u64:: from ( confirmations) > light_client_last_block {
564592 return Err ( BridgeSdkError :: LightClientNotSynced (
565593 light_client_last_block,
566594 ) ) ;
567595 }
568596
569- let near_bridge_client = self . near_bridge_client ( ) ?;
570597 let args = BtcVerifyWithdrawArgs {
571598 tx_id : tx_hash,
572599 tx_block_blockhash : proof_data. tx_block_blockhash ,
0 commit comments