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

  Changed paths:
    M blockchain/blockindex.go
    M blockchain/blocklocator.go
    M blockchain/chain.go
    M blockchain/chainio.go
    M blockchain/fullblocks_test.go
    M blockchain/thresholdstate.go
    M blockchain/thresholdstate_test.go
    M blockchain/validate.go
    M blockmanager.go
    M cmd/findcheckpoint/findcheckpoint.go
    M mining/cpuminer/cpuminer.go
    M mining/mining.go
    M rpcserver.go
    M rpcwebsocket.go
    M server.go

  Log Message:
  -----------
  blockchain: Use hash values in structs.

This modifies the blockNode and BestState structs in the blockchain
package to store hashes directly instead of pointers to them and updates
callers to deal with the API change in the exported BestState struct.

In general, the preferred approach for hashes moving forward is to store
hash values in complex data structures, particularly those that will be
used for cache entries, and accept pointers to hashes in arguments to
functions.

Some of the reasoning behind making this change is:

- It is generally preferred to avoid storing pointers to data in cache
  objects since doing so can easily lead to storing interior pointers
  into other structs that then can't be GC'd
- Keeping the hash values directly in the block node provides better
  cache locality


Reply via email to