// persiste the current live and return:
// chkpt: sequence number of current checkpoint
// root: live root hash when creating checkpoint
// err: when it is not nil, chkpt and root are not available
persiste the current live and return:
chkpt: sequence number of current checkpoint
root: live root hash when creating checkpoint
err: when it is not nil, chkpt and root are not available
// persiste the current live and return : // chkpt : sequence number of current checkpoint // root : live root hash when creating checkpoint // err : when it is not nil chkpt and root are not available
func (r *RevertableTrie) CheckPoint() (chkpt int, root []byte, err error) {
	r.lock.Lock()
	defer r.lock.Unlock()
	root, err = r.preCommitLocked()
	if err != nil {
		return -1, nil, err
	}
	rootHash := common.BytesToHash(root)
	r.chkpts = append(r.chkpts, rootHash)
	return len(r.chkpts) - 1, root, nil
}
func ( r * RevertableTrie ) CheckPoint ( ) ( chkpt int , root [ ] byte , err error ) { r . lock . Lock ( ) defer r . lock . Unlock ( ) root , err = r . preCommitLocked ( ) if err != nil { return - 1 , nil , err } rootHash := common . BytesToHash ( root ) r . chkpts = append ( r . chkpts , rootHash ) return len ( r . chkpts ) - 1 , root , nil }
persiste the current live and return:
chkpt: sequence number of current checkpoint
root: live root hash when creating checkpoint
err: when it is not nil, chkpt and root are not available
persiste the current live and return : chkpt : sequence number of current checkpoint root : live root hash when creating checkpoint err : when it is not nil chkpt and root are not available