func (b *BadgerTreeTransaction) Root() (*Node, error) {
	i, err := b.tx.Get([]byte("root"))
	if err != nil {
		return nil, nil
	}

	rootHash, err := i.ValueCopy(nil)
	if err != nil {
		return nil, err
	}

	if bytes.Equal(rootHash, primitives.EmptyTree[:]) {
		return nil, nil
	}

	nodeKey, err := b.tx.Get(getTreeKey(rootHash))
	if err != nil {
		return nil, err
	}

	nodeSer, err := nodeKey.ValueCopy(nil)
	if err != nil {
		return nil, err
	}

	return DeserializeNode(nodeSer)
}
// Root gets the root node.
Root gets the root node.
// Root gets the root node .
func (b *BadgerTreeTransaction) Root() (*Node, error) {
	i, err := b.tx.Get([]byte("root"))
	if err != nil {
		return nil, nil
	}
	rootHash, err := i.ValueCopy(nil)
	if err != nil {
		return nil, err
	}
	if bytes.Equal(rootHash, primitives.EmptyTree[:]) {
		return nil, nil
	}
	nodeKey, err := b.tx.Get(getTreeKey(rootHash))
	if err != nil {
		return nil, err
	}
	nodeSer, err := nodeKey.ValueCopy(nil)
	if err != nil {
		return nil, err
	}
	return DeserializeNode(nodeSer)
}
func ( b * BadgerTreeTransaction ) Root ( ) ( * Node , error ) { i , err := b . tx . Get ( [ ] byte ( " " ) ) if err != nil { return nil , nil } rootHash , err := i . ValueCopy ( nil ) if err != nil { return nil , err } if bytes . Equal ( rootHash , primitives . EmptyTree [ : ] ) { return nil , nil } nodeKey , err := b . tx . Get ( getTreeKey ( rootHash ) ) if err != nil { return nil , err } nodeSer , err := nodeKey . ValueCopy ( nil ) if err != nil { return nil , err } return DeserializeNode ( nodeSer ) }
Root gets the root node.
Root gets the root node .