func (t *TreeMemoryCacheTransaction) SetRoot(n *Node) error {
	if !t.update {
		return errors.New("set root called on View transaction")
	}

	nodeHash := n.GetHash()
	if _, found := t.dirty[nodeHash]; !found {
		if _, err := t.underlyingTransaction.GetNode(nodeHash); err != nil {
			err := t.SetNode(n)
			if err != nil {
				return err
			}
		}
	}
	t.root = nodeHash

	return nil
}
// SetRoot sets the root for the current transaction. If it does not exist in the cache or the underlying data store,
// add it to the cache.
SetRoot sets the root for the current transaction. If it does not exist in the cache or the underlying data store,
add it to the cache.
// SetRoot sets the root for the current transaction . If it does not exist in the cache or the underlying data store // add it to the cache .
func (t *TreeMemoryCacheTransaction) SetRoot(n *Node) error {
	if !t.update {
		return errors.New("set root called on View transaction")
	}
	nodeHash := n.GetHash()
	if _, found := t.dirty[nodeHash]; !found {
		if _, err := t.underlyingTransaction.GetNode(nodeHash); err != nil {
			err := t.SetNode(n)
			if err != nil {
				return err
			}
		}
	}
	t.root = nodeHash
	return nil
}
func ( t * TreeMemoryCacheTransaction ) SetRoot ( n * Node ) error { if ! t . update { return errors . New ( " " ) } nodeHash := n . GetHash ( ) if _ , found := t . dirty [ nodeHash ] ; ! found { if _ , err := t . underlyingTransaction . GetNode ( nodeHash ) ; err != nil { err := t . SetNode ( n ) if err != nil { return err } } } t . root = nodeHash return nil }
SetRoot sets the root for the current transaction.
SetRoot sets the root for the current transaction .