ManojNimbalkar / bitcoin-wallet

Automatically exported from code.google.com/p/bitcoin-wallet
0 stars 0 forks source link

Quick hack to make initial header sync faster #138

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently the app ships with a chain file that is 19 months out of date. A 
quick hack to make startup faster until sync starts from a recent checkpoint is 
to just refresh the file. If a user imports a key or wallet, you can then just 
truncate the chain back to the original size using 

http://docs.oracle.com/javase/1.4.2/docs/api/java/nio/channels/FileChannel.html#
truncate(long)

Original issue reported on code.google.com by hearn@google.com on 23 Feb 2013 at 11:06

GoogleCodeExporter commented 9 years ago
Interesting idea. Do I need to adjust the chain head hash in the first bytes of 
the file?

The downside of this approach is it will use up another 8.5 MB of storage 
immediately. That's the size differences between the APKs, and Android keeps 
them around.

Original comment by andreas....@gmail.com on 23 Feb 2013 at 11:14

GoogleCodeExporter commented 9 years ago
Yeah, but you can set the chain head using methods on the BOBS object.

I'm watching the sync on my tablet for a new install of the app. For some 
reason we're STILL seeing sometimes "duplicated block" messages. I don't 
understand why this still happens :( I will investigate some more.

Original comment by hearn@google.com on 23 Feb 2013 at 11:20

GoogleCodeExporter commented 9 years ago
This workaround will not be needed any more, thanks to SPVBlockStore and 
checkpoints.

Thanks anyway for this idea.

Original comment by andreas....@gmail.com on 8 Mar 2013 at 2:44