// append at the end in order, if key != expecting, or value is empty, return ErrIllegalParams
append at the end in order, if key != expecting, or value is empty, return ErrIllegalParams
// append at the end in order if key ! = expecting or value is empty return ErrIllegalParams
func (h *HistoryTree) Append(key uint64, value []byte) (err error) {
	if key != h.expecting {
		return common.ErrIllegalParams
	}
	if len(value) == 0 {
		return common.ErrIllegalStatus
	}
	prefix := heightToPrefix(key)
	current := h.root
	if current == nil {
		h.root = NewTreeNode()
		current = h.root
		current.isLeaf = false
	}
	changed, err := current.appendDescendant(h.adapter, prefix, 0, value)
	if err != nil {
		return err
	}
	if changed {
		h.expecting++
	}
	return nil
}
func ( h * HistoryTree ) Append ( key uint64 , value [ ] byte ) ( err error ) { if key != h . expecting { return common . ErrIllegalParams } if len ( value ) == 0 { return common . ErrIllegalStatus } prefix := heightToPrefix ( key ) current := h . root if current == nil { h . root = NewTreeNode ( ) current = h . root current . isLeaf = false } changed , err := current . appendDescendant ( h . adapter , prefix , 0 , value ) if err != nil { return err } if changed { h . expecting ++ } return nil }
append at the end in order, if key != expecting, or value is empty, return ErrIllegalParams
append at the end in order if key ! = expecting or value is empty return ErrIllegalParams
// Use the recursive method to easily set the isDirty of the node on the path