@@ -5,8 +5,8 @@ use crate::db::{
5
5
} ;
6
6
use crate :: hord:: {
7
7
self , get_inscriptions_revealed_in_block,
8
- update_storage_and_augment_bitcoin_block_with_inscription_reveal_data ,
9
- update_storage_and_augment_bitcoin_block_with_inscription_transfer_data , Storage ,
8
+ update_storage_and_augment_bitcoin_block_with_inscription_reveal_data_tx ,
9
+ update_storage_and_augment_bitcoin_block_with_inscription_transfer_data_tx ,
10
10
} ;
11
11
use crate :: service:: {
12
12
open_readwrite_predicates_db_conn_or_panic, update_predicate_status, PredicateStatus ,
@@ -25,7 +25,7 @@ use chainhook_sdk::indexer::bitcoin::{
25
25
use chainhook_sdk:: observer:: { gather_proofs, EventObserverConfig } ;
26
26
use chainhook_sdk:: utils:: { file_append, send_request, Context } ;
27
27
use chainhook_types:: { BitcoinBlockData , BitcoinChainEvent , BitcoinChainUpdatedWithBlocksData } ;
28
- use std:: collections:: { BTreeMap , HashMap } ;
28
+ use std:: collections:: HashMap ;
29
29
30
30
pub async fn scan_bitcoin_chainstate_via_rpc_using_predicate (
31
31
predicate_spec : & BitcoinChainhookSpecification ,
@@ -94,7 +94,6 @@ pub async fn scan_bitcoin_chainstate_via_rpc_using_predicate(
94
94
let bitcoin_config = event_observer_config. get_bitcoin_config ( ) ;
95
95
let mut traversals = HashMap :: new ( ) ;
96
96
97
- let mut storage = Storage :: Memory ( BTreeMap :: new ( ) ) ;
98
97
let mut cursor = start_block. saturating_sub ( 1 ) ;
99
98
100
99
while cursor <= end_block {
@@ -125,7 +124,7 @@ pub async fn scan_bitcoin_chainstate_via_rpc_using_predicate(
125
124
}
126
125
} ;
127
126
128
- if let Some ( ref inscriptions_db_conn) = inscriptions_db_conn {
127
+ if let Some ( ref mut inscriptions_db_conn) = inscriptions_db_conn {
129
128
// Evaluating every single block is required for also keeping track of transfers.
130
129
let local_traverals =
131
130
find_all_inscriptions_in_block ( & cursor, & inscriptions_db_conn, & ctx) ;
@@ -139,18 +138,19 @@ pub async fn scan_bitcoin_chainstate_via_rpc_using_predicate(
139
138
) ;
140
139
}
141
140
142
- let _ = update_storage_and_augment_bitcoin_block_with_inscription_reveal_data (
141
+ let transaction = inscriptions_db_conn. transaction ( ) . unwrap ( ) ;
142
+ let empty_ctx = Context :: empty ( ) ;
143
+ let _ = update_storage_and_augment_bitcoin_block_with_inscription_reveal_data_tx (
143
144
& mut block,
144
- & mut storage ,
145
+ & transaction ,
145
146
& traversals,
146
- & inscriptions_db_conn,
147
- & ctx,
147
+ & empty_ctx,
148
148
) ?;
149
149
150
- let _ = update_storage_and_augment_bitcoin_block_with_inscription_transfer_data (
150
+ let _ = update_storage_and_augment_bitcoin_block_with_inscription_transfer_data_tx (
151
151
& mut block,
152
- & mut storage ,
153
- & ctx ,
152
+ & transaction ,
153
+ & empty_ctx ,
154
154
) ?;
155
155
156
156
let inscriptions_revealed = get_inscriptions_revealed_in_block ( & block)
0 commit comments