@@ -46,7 +46,6 @@ def perform(cell_ids)
4646 lock_type : "rgbpp" ,
4747 cell_output_id : cell_output . id ,
4848 }
49-
5049 rescue StandardError => e
5150 Rails . logger . error ( "Handle rgbpp cell (id: #{ cell_output . id } ) failed: #{ e . message } " )
5251 raise e
@@ -86,7 +85,7 @@ def build_utxo_map(cell_outputs)
8685 end
8786
8887 def fetch_raw_transactions! ( utxo_map )
89- txids = utxo_map . values . map { _1 [ :txid ] } . uniq
88+ txids = utxo_map . values . pluck ( :txid ) . uniq
9089
9190 raw_tx_data = { }
9291 txids . each do |txid |
@@ -124,7 +123,7 @@ def build_transactions!(cell_outputs, raw_tx_data, utxo_map)
124123
125124 unique_transaction_attributes = transaction_attributes . values
126125 BitcoinTransaction . upsert_all ( unique_transaction_attributes , unique_by : :txid )
127- BitcoinTransaction . where ( txid : unique_transaction_attributes . map { | tx | tx [ :txid ] } ) . index_by ( &:txid )
126+ BitcoinTransaction . where ( txid : unique_transaction_attributes . pluck ( :txid ) ) . index_by ( &:txid )
128127 end
129128
130129 def build_op_returns! ( raw_tx , tx , ckb_tx )
@@ -174,6 +173,10 @@ def build_address!(address_hash, cell_output)
174173
175174 BtcAccountBook . find_or_create_by! ( ckb_transaction_id : cell_output . ckb_transaction_id , bitcoin_address_id : bitcoin_address . id )
176175
176+ if cell_output . consumed_by_id
177+ BtcAccountBook . find_or_create_by! ( ckb_transaction_id : cell_output . consumed_by_id , bitcoin_address_id : bitcoin_address . id )
178+ end
179+
177180 bitcoin_address
178181 end
179182
0 commit comments