@@ -234,83 +234,68 @@ impl OrdinalIndexUpdater {
234
234
. and_then ( |option| {
235
235
option
236
236
. map ( |hash| {
237
- if height >= first_inscription_height {
238
- let block: Block =
239
- client. call ( "getblock" , & [ json ! ( hash) , json ! ( 2 ) ] ) ?;
240
- let bits = hex:: decode ( block. bits ) . unwrap ( ) ;
241
- let block_data = BlockData {
242
- header : BlockHeader {
243
- version : block. version ,
244
- prev_blockhash : block. previousblockhash ,
245
- merkle_root : block. merkleroot ,
246
- time : block. time as u32 ,
247
- bits : u32:: from_be_bytes ( [
248
- bits[ 0 ] , bits[ 1 ] , bits[ 2 ] , bits[ 3 ] ,
249
- ] ) ,
250
- nonce : block. nonce ,
251
- } ,
252
- txdata : block
253
- . tx
254
- . iter ( )
255
- . map ( |tx| {
256
- (
257
- Transaction {
258
- version : tx. version as i32 ,
259
- lock_time : PackedLockTime ( tx. locktime ) ,
260
- input : tx
261
- . vin
262
- . iter ( )
263
- . map ( |i| TxIn {
264
- previous_output : match ( i. txid , i. vout )
265
- {
266
- ( Some ( txid) , Some ( vout) ) => {
267
- OutPoint { txid, vout }
268
- }
269
- _ => OutPoint :: null ( ) ,
270
- } ,
271
- script_sig : match i. script_sig {
272
- Some ( ref script_sig) => {
273
- script_sig. script ( ) . unwrap ( )
274
- }
275
- None => Script :: default ( ) ,
276
- } ,
277
- sequence :
278
- bitcoincore_rpc:: bitcoin:: Sequence (
279
- i. sequence ,
280
- ) ,
281
- witness : Witness :: from_vec (
282
- i. txinwitness
283
- . clone ( )
284
- . unwrap_or ( vec ! [ ] ) ,
237
+ let block: Block = client. call ( "getblock" , & [ json ! ( hash) , json ! ( 2 ) ] ) ?;
238
+ let bits = hex:: decode ( block. bits ) . unwrap ( ) ;
239
+ let block_data = BlockData {
240
+ header : BlockHeader {
241
+ version : block. version ,
242
+ prev_blockhash : block. previousblockhash ,
243
+ merkle_root : block. merkleroot ,
244
+ time : block. time as u32 ,
245
+ bits : u32:: from_be_bytes ( [ bits[ 0 ] , bits[ 1 ] , bits[ 2 ] , bits[ 3 ] ] ) ,
246
+ nonce : block. nonce ,
247
+ } ,
248
+ txdata : block
249
+ . tx
250
+ . iter ( )
251
+ . map ( |tx| {
252
+ (
253
+ Transaction {
254
+ version : tx. version as i32 ,
255
+ lock_time : PackedLockTime ( tx. locktime ) ,
256
+ input : tx
257
+ . vin
258
+ . iter ( )
259
+ . map ( |i| TxIn {
260
+ previous_output : match ( i. txid , i. vout ) {
261
+ ( Some ( txid) , Some ( vout) ) => {
262
+ OutPoint { txid, vout }
263
+ }
264
+ _ => OutPoint :: null ( ) ,
265
+ } ,
266
+ script_sig : match i. script_sig {
267
+ Some ( ref script_sig) => {
268
+ script_sig. script ( ) . unwrap ( )
269
+ }
270
+ None => Script :: default ( ) ,
271
+ } ,
272
+ sequence :
273
+ bitcoincore_rpc:: bitcoin:: Sequence (
274
+ i. sequence ,
285
275
) ,
286
- } )
287
- . collect ( ) ,
288
- output : tx
289
- . vout
290
- . iter ( )
291
- . map ( |o| TxOut {
292
- value : o. value . to_sat ( ) ,
293
- script_pubkey : o
294
- . script_pub_key
295
- . script ( )
296
- . unwrap ( ) ,
297
- } )
298
- . collect ( ) ,
299
- } ,
300
- tx. txid ,
301
- )
302
- } )
303
- . collect :: < Vec < ( Transaction , Txid ) > > ( ) ,
304
- } ;
305
- Ok ( block_data)
306
- } else {
307
- let header = client. get_block_header ( & hash) ?;
308
- let block_data = BlockData {
309
- header,
310
- txdata : Vec :: new ( ) ,
311
- } ;
312
- Ok ( block_data)
313
- }
276
+ witness : Witness :: from_vec (
277
+ i. txinwitness . clone ( ) . unwrap_or ( vec ! [ ] ) ,
278
+ ) ,
279
+ } )
280
+ . collect ( ) ,
281
+ output : tx
282
+ . vout
283
+ . iter ( )
284
+ . map ( |o| TxOut {
285
+ value : o. value . to_sat ( ) ,
286
+ script_pubkey : o
287
+ . script_pub_key
288
+ . script ( )
289
+ . unwrap ( ) ,
290
+ } )
291
+ . collect ( ) ,
292
+ } ,
293
+ tx. txid ,
294
+ )
295
+ } )
296
+ . collect :: < Vec < ( Transaction , Txid ) > > ( ) ,
297
+ } ;
298
+ Ok ( block_data)
314
299
} )
315
300
. transpose ( )
316
301
} ) {
0 commit comments