@@ -42,7 +42,7 @@ import { ElectrsService, ELECTRS_URLS_BY_NETWORK } from "./electrs";
4242import { fetchNbtcAddresses , fetchPackageConfigs , type Storage } from "./storage" ;
4343import { CFStorage } from "./cf-storage" ;
4444import type { PutNbtcTxResponse } from "./rpc-interface" ;
45- import { extractSenderAddress } from "./btc-address-utils" ;
45+ import { extractAllSenderAddress } from "./btc-address-utils" ;
4646import type { ComplianceRpc } from "@gonative-cc/lib/rpc-types" ;
4747
4848interface ConfirmingTxCandidate < T > {
@@ -710,16 +710,37 @@ export class Indexer {
710710 const client = this . getSuiClient ( config . sui_network ) ;
711711 const pkgKey = config . nbtc_pkg ;
712712
713- // Filter out sanctioned addresses before minting
713+ // Extract all sender addresses at once
714+ const senderAddressMap : Map < number , string | null > = await extractAllSenderAddress (
715+ mintArgs ,
716+ config . btc_network ,
717+ ) ;
718+
719+ // Check all addresses for blocking at once
720+ const uniqueAddresses = [
721+ ...new Set (
722+ Array . from ( senderAddressMap . values ( ) ) . filter ( ( a ) : a is string => a !== null ) ,
723+ ) ,
724+ ] ;
725+ const blockedAddressSet = new Set < string > ( ) ;
726+ await Promise . all (
727+ uniqueAddresses . map ( async ( addr ) => {
728+ if ( await this . compliance . isBtcBlocked ( addr ) ) {
729+ blockedAddressSet . add ( addr ) ;
730+ }
731+ } ) ,
732+ ) ;
733+
734+ // Filter out sanctioned addresses
714735 const filteredMintArgs : MintBatchArg [ ] = [ ] ;
715736 const filteredProcessedKeys : ProcessedKey [ ] = [ ] ;
716737
717738 for ( let i = 0 ; i < mintArgs . length ; i ++ ) {
718739 const args = mintArgs [ i ] ;
719740 if ( ! args ) continue ;
720741
721- const senderAddress = await extractSenderAddress ( args . tx , config . btc_network ) ;
722- if ( senderAddress && ( await this . compliance . isBtcBlocked ( senderAddress ) ) ) {
742+ const senderAddress = senderAddressMap . get ( i ) ;
743+ if ( senderAddress && blockedAddressSet . has ( senderAddress ) ) {
723744 logger . error ( {
724745 msg : "Sanctioned address detected, skipping mint" ,
725746 txId : args . tx . getId ( ) ,
0 commit comments