Branch: refs/heads/master
  Home:   https://github.com/btcsuite/btcd
  Commit: 59169540c3842710ed7e2d4c57f448d0e8bd7138
      
https://github.com/btcsuite/btcd/commit/59169540c3842710ed7e2d4c57f448d0e8bd7138
  Author: Dave Collins <da...@conformal.com>
  Date:   2017-02-01 (Wed, 01 Feb 2017)

  Changed paths:
    M blockchain/chain.go
    M rpcserver.go
    M server.go

  Log Message:
  -----------
  blockchain: Reconstruct headers from block nodes.

This modifies the block node structure to include a couple of extra
fields needed to be able to reconstruct the block header from a node,
and exposes a new function from chain to fetch the block headers which
takes advantage of the new functionality to reconstruct the headers from
memory when possible.  Finally, it updates both the p2p and RPC servers
to make use of the new function.

This is useful since many of the block header fields need to be kept in
order to form the block index anyways and storing the extra fields means
the database does not have to be consulted when headers are requested if
the associated node is still in memory.

The following timings show representative performance gains as measured
from one system:

new: Time to fetch 100000 headers:   59ms
old: Time to fetch 100000 headers: 4783ms


Reply via email to