Skip to content
  • Dave Collins's avatar
    blockchain: Use hash values in structs. · d06c0bb1
    Dave Collins authored
    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
    d06c0bb1