11use bitcoin:: { blockdata:: locktime:: absolute:: LockTime , Txid } ;
2- use dftx_rs:: Transaction ;
2+ use dftx_rs:: { Block , Transaction } ;
33use log:: debug;
44
55use super :: BlockContext ;
@@ -42,7 +42,7 @@ pub fn index_transactions(ctx: &BlockContext, tx: Transaction) -> Result<()> {
4242 } ;
4343 // Index transaction
4444 SERVICES . transaction . by_id . put ( & tx_id, & trx) ?;
45- // Index transaction vin
45+ // Indexing transaction vin
4646 for ( vin_idx, vin) in tx. input . iter ( ) . enumerate ( ) {
4747 let trx_vin = TransactionVin {
4848 id : format ! ( "{}-{}" , tx_id, vin_idx) ,
@@ -65,10 +65,7 @@ pub fn index_transactions(ctx: &BlockContext, tx: Transaction) -> Result<()> {
6565 sequence : vin. sequence . to_string ( ) ,
6666 } ;
6767
68- SERVICES
69- . transaction
70- . vin_by_id
71- . put ( & tx_id. to_string ( ) , & trx_vin) ?;
68+ SERVICES . transaction . vin_by_id . put ( & tx_id, & trx_vin) ?;
7269 }
7370 // Index transaction vout
7471 for ( vout_idx, vout) in tx. output . iter ( ) . enumerate ( ) {
@@ -83,10 +80,7 @@ pub fn index_transactions(ctx: &BlockContext, tx: Transaction) -> Result<()> {
8380 r#type : "pubkey" . to_string ( ) ,
8481 } ,
8582 } ;
86- SERVICES
87- . transaction
88- . vout_by_id
89- . put ( & tx_id. to_string ( ) , & trx_vout) ?;
83+ SERVICES . transaction . vout_by_id . put ( & tx_id, & trx_vout) ?;
9084 // .put(&format!("{}-{}", tx_id, vout_idx), &trx_vout)?; //need
9185 }
9286
0 commit comments