func (m *CPPMerkleTree) RootAtSnapshot(snapshot uint64) ([]byte, error) {
	hash := make([]byte, m.nodeSize)
	success := C.RootAtSnapshot(m.peer, C.BYTE_SLICE(&hash), C.size_t(snapshot))
	if !success {
		return nil, fmt.Errorf("failed to get root at snapshot %d", snapshot)
	}
	return hash, nil
}
// RootAtSnapshot returns the root at a given index.
func (m *CPPMerkleTree) RootAtSnapshot(snapshot uint64) ([]byte, error) {
	hash := make([]byte, m.nodeSize)
	size := C.RootAtSnapshot(m.peer, C.size_t(snapshot), unsafe.Pointer(&hash[0]), C.size_t(len(hash)))
	if got, want := size, m.nodeSize; got != want {
		return nil, fmt.Errorf("failed to get root at snapshot %d, got %d bytes, expected %d", snapshot, got, want)
	}
	return hash, nil
}