@@ -296,34 +296,39 @@ pub fn standardize_bitcoin_block(
296
296
297
297
let mut inputs = vec ! [ ] ;
298
298
let mut sats_in = 0 ;
299
- for input in tx. vin . drain ( ..) {
299
+ for ( index , input) in tx. vin . drain ( ..) . enumerate ( ) {
300
300
if input. is_coinbase ( ) {
301
301
continue ;
302
302
}
303
- let value = input
304
- . prevout
305
- . as_ref ( )
306
- . expect ( "not provided for coinbase txs" )
307
- . value
308
- . to_sat ( ) ;
309
- sats_in += value;
303
+ let prevout = input. prevout . as_ref ( ) . ok_or ( format ! (
304
+ "error retrieving prevout for transaction {}, input #{} (block #{})" ,
305
+ tx. txid, index, block. height
306
+ ) ) ?;
307
+
308
+ let txid = input. txid . as_ref ( ) . ok_or ( format ! (
309
+ "error retrieving txid for transaction {}, input #{} (block #{})" ,
310
+ tx. txid, index, block. height
311
+ ) ) ?;
312
+
313
+ let vout = input. vout . ok_or ( format ! (
314
+ "error retrieving vout for transaction {}, input #{} (block #{})" ,
315
+ tx. txid, index, block. height
316
+ ) ) ?;
317
+
318
+ let script_sig = input. script_sig . ok_or ( format ! (
319
+ "error retrieving script_sig for transaction {}, input #{} (block #{})" ,
320
+ tx. txid, index, block. height
321
+ ) ) ?;
322
+
323
+ sats_in += prevout. value . to_sat ( ) ;
310
324
inputs. push ( TxIn {
311
325
previous_output : OutPoint {
312
- txid : format ! (
313
- "0x{}" ,
314
- input
315
- . txid
316
- . expect( "not provided for coinbase txs" )
317
- . to_string( )
318
- ) ,
319
- vout : input. vout . expect ( "not provided for coinbase txs" ) ,
320
- block_height : input. prevout . expect ( "not provided for coinbase txs" ) . height ,
321
- value,
326
+ txid : format ! ( "0x{}" , txid. to_string( ) ) ,
327
+ vout,
328
+ block_height : prevout. height ,
329
+ value : prevout. value . to_sat ( ) ,
322
330
} ,
323
- script_sig : format ! (
324
- "0x{}" ,
325
- hex:: encode( & input. script_sig. expect( "not provided for coinbase txs" ) . hex)
326
- ) ,
331
+ script_sig : format ! ( "0x{}" , hex:: encode( & script_sig. hex) ) ,
327
332
sequence : input. sequence ,
328
333
witness : input
329
334
. txinwitness
@@ -578,15 +583,15 @@ fn try_parse_stacks_operation(
578
583
// }
579
584
// }
580
585
581
- let pox_cycle_id = pox_config. get_pox_cycle_id ( block_height) ;
582
- let pox_cycle_len = pox_config. get_pox_cycle_len ( ) ;
583
- let pox_cycle_pos = pox_config. get_pos_in_pox_cycle ( block_height) ;
586
+ let pox_cycle_index = pox_config. get_pox_cycle_id ( block_height) ;
587
+ let pox_cycle_length = pox_config. get_pox_cycle_len ( ) ;
588
+ let pox_cycle_position = pox_config. get_pos_in_pox_cycle ( block_height) ;
584
589
585
590
StacksBaseChainOperation :: BlockCommitted ( StacksBlockCommitmentData {
586
591
block_hash : res. stacks_block_hash ,
587
- pox_cycle_id ,
588
- pox_cycle_len ,
589
- pox_cycle_pos ,
592
+ pox_cycle_index ,
593
+ pox_cycle_length ,
594
+ pox_cycle_position ,
590
595
pox_sats_burnt,
591
596
pox_sats_transferred,
592
597
// mining_address_pre_commit: None,
0 commit comments