Commit Graph

14 Commits

Author SHA1 Message Date
TomZ fb2854f23d Add unspentdb Duplicate command. 2020-03-05 23:29:53 +01:00
TomZ 7ce5880f95 Make unspent-db command easier to use
This change drops the various arguments that force the user to select if
an argument is an .info file or a .db file etc. Instead auto-detect them
and also allow the user to provide a list of arguments.

The most direct effect is that I can now run 'unspent-db info *.info"
2020-03-05 23:29:52 +01:00
TomZ d9604e3f33 Design a better detection for need of UTXO-GC
Doing a garbage collect of the Sha256 based databases means we remove
all the records that have been deleted from our file.
We also sort the file to have all the jump-tables at the end, making it
much cheaper on memory-locality to find (or not) items in the DB.

The downsides are that this prune step takes time, writes dozens of MBs
and that we lose checkpoints. The latter means we no longer can rollback
to a safe position, simply because we flushed those records.

So we want to do this often enough to avoid fragmentation but not too
often because it creates a greater risk on data consistency.

This algoritm checks the actual data and calculates the fragmentation of
the jump-tables to decide if we want to start a GC.

When we do GC, we try to do as many files as makes sense, to make sure we
can wait quite a long time before we need to do a new GC.
2020-03-05 23:29:52 +01:00
TomZ ec52bd5efe Make unspentdb info command support new tags 2020-03-01 17:10:24 +01:00
TomZ a28ffd18bb Write less txid's to the DB file and write shorter ones.
When pruning we sort leafs by txid / output and refrain from
writing the txid repeatedly for outputs of the same tx.
Additionally, use the fact that we only ever get to a leaf via
a bucket and since the first 64 bits of a txid is there, skip
repeating them when writing to disk.
Last, make pruning have different strategies.

This should shrink the utxo by about 40%
2018-09-24 21:24:28 +02:00
TomZ c55c5ebe32 make lookup command a bit more useful. 2018-09-20 21:55:07 +02:00
TomZ fb6b7f562d Add CLI command Lookup (for the utxo) 2018-09-20 21:55:07 +02:00
TomZ 41771b8060 Finish up check command 2018-09-20 21:55:07 +02:00
TomZ 9a8bc78700 Move common code to the baseclass and start Check command 2018-09-20 21:55:07 +02:00
TomZ 6c0f39317f Copy some data in the prune command 2018-09-20 21:55:07 +02:00
TomZ 44d7dae89a Start prune command 2018-09-20 21:55:07 +02:00
TomZ 067c196a81 Add -v option to show bucket usage. 2018-09-20 21:55:07 +02:00
TomZ da90708d7f Implement proper expansion of files. 2018-09-20 21:55:07 +02:00
TomZ f81fea1a89 Add InfoCommand to show details of an info file 2018-09-20 21:55:07 +02:00