// returns hash of the value, serialization of the value and error
returns hash of the value, serialization of the value and error
// returns hash of the value serialization of the value and error
func (n *node) valueHash() ([]byte, []byte, error) {
	if n.hasValue() {
		if n.valuehash != nil && n.valuestream != nil {
			return n.valuehash, n.valuestream, nil
		}
		buf := new(bytes.Buffer)
		err := n.valueEncode(n.value, buf)
		if err != nil {
			return nil, nil, err
		}
		valuebytes := buf.Bytes()
		var r []byte
		if n.valueHasher != nil {
			r, err = n.valueHasher(n.value, valuebytes)
		} else {
			r, err = DefaultValueHasher(n.value, valuebytes)
		}
		if err != nil {
			return nil, nil, err
		}
		n.valuehash = r
		n.valuestream = valuebytes
		return r, valuebytes, nil
	}
	return nil, nil, nil
}
func ( n * node ) valueHash ( ) ( [ ] byte , [ ] byte , error ) { if n . hasValue ( ) { if n . valuehash != nil && n . valuestream != nil { return n . valuehash , n . valuestream , nil } buf := new ( bytes . Buffer ) err := n . valueEncode ( n . value , buf ) if err != nil { return nil , nil , err } valuebytes := buf . Bytes ( ) var r [ ] byte if n . valueHasher != nil { r , err = n . valueHasher ( n . value , valuebytes ) } else { r , err = DefaultValueHasher ( n . value , valuebytes ) } if err != nil { return nil , nil , err } n . valuehash = r n . valuestream = valuebytes return r , valuebytes , nil } return nil , nil , nil }
returns hash of the value, serialization of the value and error
returns hash of the value serialization of the value and error