code: func (h *hasher) store(n node, db *Database, force bool) (node, error) {
  	// Don't store hashes or empty nodes.
  	if _, isHash := n.(hashNode); n == nil || isHash {
  		return n, nil
  	}
  	// Generate the RLP encoding of the node
  	h.tmp.Reset()
  	if err := rlp.Encode(&h.tmp, n); err != nil {
  		panic("encode error: " + err.Error())
  	}
  	if len(h.tmp) < 32 && !force {
  		return n, nil // Nodes smaller than 32 bytes are stored inside their parent
  	}
  	// Larger nodes are replaced by their hash and stored in the database.
  	hash, _ := n.cache()
  	if hash == nil {
  		hash = h.makeHashNode(h.tmp)
  	}
  
  	if db != nil {
  		// We are pooling the trie nodes into an intermediate memory cache
  		hash := common.BytesToHash(hash)
  
  		db.lock.Lock()
  		db.insert(hash, h.tmp, n)
  		db.lock.Unlock()
  
  		// Track external references from account->storage trie
  		if h.onleaf != nil {
  			switch n := n.(type) {
  			case *shortNode:
  				if child, ok := n.Val.(valueNode); ok {
  					h.onleaf(child, hash)
  				}
  			case *fullNode:
  				for i := 0; i < 16; i++ {
  					if child, ok := n.Children[i].(valueNode); ok {
  						h.onleaf(child, hash)
  					}
  				}
  			}
  		}
  	}
  	return hash, nil
  }
docs: // store hashes the node n and if we have a storage layer specified, it writes
  // the key/value pair to it and tracks any node->child references as well as any
  // node->external trie references.