@@ -126,12 +126,11 @@ fn create_or_open_readwrite_db(cache_path: &PathBuf, ctx: &Context) -> Connectio
126
126
} ;
127
127
// db.profile(Some(trace_profile));
128
128
// db.busy_handler(Some(tx_busy_handler))?;
129
-
130
- let mmap_size: i64 = 256 * 1024 * 1024 ;
131
- let page_size: i64 = 16384 ;
132
- conn. pragma_update ( None , "mmap_size" , mmap_size) . unwrap ( ) ;
133
- conn. pragma_update ( None , "page_size" , page_size) . unwrap ( ) ;
134
- conn. pragma_update ( None , "synchronous" , & "NORMAL" ) . unwrap ( ) ;
129
+ // let mmap_size: i64 = 256 * 1024 * 1024;
130
+ // let page_size: i64 = 16384;
131
+ // conn.pragma_update(None, "mmap_size", mmap_size).unwrap();
132
+ // conn.pragma_update(None, "page_size", page_size).unwrap();
133
+ // conn.pragma_update(None, "synchronous", &"NORMAL").unwrap();
135
134
conn
136
135
}
137
136
@@ -197,24 +196,26 @@ fn open_existing_readonly_db(path: &PathBuf, ctx: &Context) -> Connection {
197
196
#[ repr( C ) ]
198
197
pub struct CompactedBlock (
199
198
pub (
200
- ( [ u8 ; 4 ] , u64 ) ,
201
- Vec < ( [ u8 ; 4 ] , Vec < ( [ u8 ; 4 ] , u32 , u16 , u64 ) > , Vec < u64 > ) > ,
199
+ ( [ u8 ; 8 ] , u64 ) ,
200
+ Vec < ( [ u8 ; 8 ] , Vec < ( [ u8 ; 8 ] , u32 , u16 , u64 ) > , Vec < u64 > ) > ,
202
201
) ,
203
202
) ;
204
203
205
204
use std:: io:: { Read , Write } ;
206
205
207
206
impl CompactedBlock {
208
207
fn empty ( ) -> CompactedBlock {
209
- CompactedBlock ( ( ( [ 0 , 0 , 0 , 0 ] , 0 ) , vec ! [ ] ) )
208
+ CompactedBlock ( ( ( [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , 0 ) , vec ! [ ] ) )
210
209
}
211
210
212
211
pub fn from_full_block ( block : & BitcoinBlockFullBreakdown ) -> CompactedBlock {
213
212
let mut txs = vec ! [ ] ;
214
213
let mut coinbase_value = 0 ;
215
214
let coinbase_txid = {
216
215
let txid = hex:: decode ( block. tx [ 0 ] . txid . to_string ( ) ) . unwrap ( ) ;
217
- [ txid[ 0 ] , txid[ 1 ] , txid[ 2 ] , txid[ 3 ] ]
216
+ [
217
+ txid[ 0 ] , txid[ 1 ] , txid[ 2 ] , txid[ 3 ] , txid[ 4 ] , txid[ 5 ] , txid[ 6 ] , txid[ 7 ] ,
218
+ ]
218
219
} ;
219
220
for coinbase_output in block. tx [ 0 ] . vout . iter ( ) {
220
221
coinbase_value += coinbase_output. value . to_sat ( ) ;
@@ -225,7 +226,9 @@ impl CompactedBlock {
225
226
let txin = hex:: decode ( input. txid . unwrap ( ) . to_string ( ) ) . unwrap ( ) ;
226
227
227
228
inputs. push ( (
228
- [ txin[ 0 ] , txin[ 1 ] , txin[ 2 ] , txin[ 3 ] ] ,
229
+ [
230
+ txin[ 0 ] , txin[ 1 ] , txin[ 2 ] , txin[ 3 ] , txin[ 4 ] , txin[ 5 ] , txin[ 6 ] , txin[ 7 ] ,
231
+ ] ,
229
232
input. prevout . as_ref ( ) . unwrap ( ) . height as u32 ,
230
233
input. vout . unwrap ( ) as u16 ,
231
234
input. prevout . as_ref ( ) . unwrap ( ) . value . to_sat ( ) ,
@@ -236,7 +239,13 @@ impl CompactedBlock {
236
239
outputs. push ( output. value . to_sat ( ) ) ;
237
240
}
238
241
let txid = hex:: decode ( tx. txid . to_string ( ) ) . unwrap ( ) ;
239
- txs. push ( ( [ txid[ 0 ] , txid[ 1 ] , txid[ 2 ] , txid[ 3 ] ] , inputs, outputs) ) ;
242
+ txs. push ( (
243
+ [
244
+ txid[ 0 ] , txid[ 1 ] , txid[ 2 ] , txid[ 3 ] , txid[ 4 ] , txid[ 5 ] , txid[ 6 ] , txid[ 7 ] ,
245
+ ] ,
246
+ inputs,
247
+ outputs,
248
+ ) ) ;
240
249
}
241
250
CompactedBlock ( ( ( coinbase_txid, coinbase_value) , txs) )
242
251
}
@@ -247,7 +256,9 @@ impl CompactedBlock {
247
256
let coinbase_txid = {
248
257
let txid =
249
258
hex:: decode ( & block. transactions [ 0 ] . transaction_identifier . hash [ 2 ..] ) . unwrap ( ) ;
250
- [ txid[ 0 ] , txid[ 1 ] , txid[ 2 ] , txid[ 3 ] ]
259
+ [
260
+ txid[ 0 ] , txid[ 1 ] , txid[ 2 ] , txid[ 3 ] , txid[ 4 ] , txid[ 5 ] , txid[ 6 ] , txid[ 7 ] ,
261
+ ]
251
262
} ;
252
263
for coinbase_output in block. transactions [ 0 ] . metadata . outputs . iter ( ) {
253
264
coinbase_value += coinbase_output. value ;
@@ -258,7 +269,9 @@ impl CompactedBlock {
258
269
let txin = hex:: decode ( & input. previous_output . txid [ 2 ..] ) . unwrap ( ) ;
259
270
260
271
inputs. push ( (
261
- [ txin[ 0 ] , txin[ 1 ] , txin[ 2 ] , txin[ 3 ] ] ,
272
+ [
273
+ txin[ 0 ] , txin[ 1 ] , txin[ 2 ] , txin[ 3 ] , txin[ 4 ] , txin[ 5 ] , txin[ 6 ] , txin[ 7 ] ,
274
+ ] ,
262
275
input. previous_output . block_height as u32 ,
263
276
input. previous_output . vout as u16 ,
264
277
input. previous_output . value ,
@@ -269,7 +282,13 @@ impl CompactedBlock {
269
282
outputs. push ( output. value ) ;
270
283
}
271
284
let txid = hex:: decode ( & tx. transaction_identifier . hash [ 2 ..] ) . unwrap ( ) ;
272
- txs. push ( ( [ txid[ 0 ] , txid[ 1 ] , txid[ 2 ] , txid[ 3 ] ] , inputs, outputs) ) ;
285
+ txs. push ( (
286
+ [
287
+ txid[ 0 ] , txid[ 1 ] , txid[ 2 ] , txid[ 3 ] , txid[ 4 ] , txid[ 5 ] , txid[ 6 ] , txid[ 7 ] ,
288
+ ] ,
289
+ inputs,
290
+ outputs,
291
+ ) ) ;
273
292
}
274
293
CompactedBlock ( ( ( coinbase_txid, coinbase_value) , txs) )
275
294
}
@@ -306,21 +325,21 @@ impl CompactedBlock {
306
325
}
307
326
308
327
fn deserialize < R : Read > ( fd : & mut R ) -> std:: io:: Result < CompactedBlock > {
309
- let mut ci = [ 0u8 ; 4 ] ;
328
+ let mut ci = [ 0u8 ; 8 ] ;
310
329
fd. read_exact ( & mut ci) ?;
311
330
let mut cv = [ 0u8 ; 8 ] ;
312
331
fd. read_exact ( & mut cv) ?;
313
332
let mut tx_len = [ 0u8 ; 8 ] ;
314
333
fd. read_exact ( & mut tx_len) ?;
315
334
let mut txs = vec ! [ ] ;
316
335
for _ in 0 ..usize:: from_be_bytes ( tx_len) {
317
- let mut txid = [ 0u8 ; 4 ] ;
336
+ let mut txid = [ 0u8 ; 8 ] ;
318
337
fd. read_exact ( & mut txid) ?;
319
338
let mut inputs_len = [ 0u8 ; 8 ] ;
320
339
fd. read_exact ( & mut inputs_len) ?;
321
340
let mut inputs = vec ! [ ] ;
322
341
for _ in 0 ..usize:: from_be_bytes ( inputs_len) {
323
- let mut txin = [ 0u8 ; 4 ] ;
342
+ let mut txin = [ 0u8 ; 8 ] ;
324
343
fd. read_exact ( & mut txin) ?;
325
344
let mut block = [ 0u8 ; 4 ] ;
326
345
fd. read_exact ( & mut block) ?;
@@ -921,7 +940,9 @@ pub fn retrieve_satoshi_point_using_local_storage(
921
940
let mut ordinal_block_number = block_identifier. index as u32 ;
922
941
let txid = {
923
942
let bytes = hex:: decode ( & transaction_identifier. hash [ 2 ..] ) . unwrap ( ) ;
924
- [ bytes[ 0 ] , bytes[ 1 ] , bytes[ 2 ] , bytes[ 3 ] ]
943
+ [
944
+ bytes[ 0 ] , bytes[ 1 ] , bytes[ 2 ] , bytes[ 3 ] , bytes[ 4 ] , bytes[ 5 ] , bytes[ 6 ] , bytes[ 7 ] ,
945
+ ]
925
946
} ;
926
947
let mut tx_cursor = ( txid, 0 ) ;
927
948
let mut hops: u32 = 0 ;
0 commit comments