novitski / bitcoinj

Automatically exported from code.google.com/p/bitcoinj
Apache License 2.0
0 stars 0 forks source link

query blockstore for (best) chain of blocks #365

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Its currently unefficient to get from a blockstore a chain of blocks. You need 
to backtrace from the head, asking the blockstore for each hash indepedently. 
And because of the independent calls, each time blockstore scans for the block 
asked for.

Usecase: Block Explorer

Solution could perhaps be a BlockStore.getRecentBlocks(int maxNumber). If you 
set maxNumber high enough, you'll just get all blocks the store has to offer 
(that are in the best chain).

Original issue reported on code.google.com by andreas....@gmail.com on 23 Mar 2013 at 9:06