bitcoin/bitcoin

.

jdom1824 opened this issue · 1 comments

(EDITED)

List of implementation changes:

  • new database layout:
    • 2 leveldb's (coins/ and blktree/ subdirs), replacing blkindex.dat
    • separate directory (blocks/) with block data (in the usual format, but smaller files) and undo data
  • database keys are of the form (char,key) instead of (string,key) for reasons of compactness
  • there is no txid-to-diskpos index anymore, only blkid-to-diskpos and txid-to-unspent-outputs
    • this makes getrawtransaction only work on unspent outputs (and slower)
      • an optional txid-to-diskpos index is planned
  • some new very specialized serializers are added (compact variable-length integer, compact amount, compact txout)
  • block index does not store hashBlockNext anymore - this is reconstructed from hashBestBlock at startup
  • at startup, automatically reorg to the best block in blktree/blocks
  • new RPCs: gettxoutsetinfo and gettxout operate on the coins database
  • no more CTxIndex in-scope: instead, a global pcoinsTip (representing the coin db) and pblocktree (representing the blktree db)
    • intended to be moved to separate modules/classes, properly encapsulated
  • blktree database contains statistics about the block file (size, which blocks in it, times, heights, undo stats, ...)
  • blktree database contains flag per block that determines the degree of validation it had, to allow future headers-first mode
  • block files are pre-allocated (in batches of 16 MiB, the files grow to max 128 MIB), to reduce fragmentation
  • transaction hashes are cached, and typically never calculated more than once

Included in the pullreq, but technically separate:

  • do -loadblock= and bootstrap.dat import in a separate thread
  • add check for strict DER encoding for signatures, and standard public keys

Originally posted by @sipa in #1677 (comment)

Hello, is there any formula or performance tests to choose the size of 128 MB as chunksize in blk*.data files?

This issue tracker is used to track technical issues related to the Bitcoin Core code base.

General bitcoin questions and/or support requests are best directed to the Bitcoin StackExchange or the #bitcoin IRC channel on the Libera Chat network.

For proposed protocol changes you can post to the bitcoin-dev mailing list.

For general bitcoin discussion you can try bitcointalk or reddit.com/r/bitcoin


Searching for questions like this on StackExchange may directly yield answers, otherwise you can simply post your new question there.