func verifyKeysAndAddr(t *testing.T, client *AttestClient, hash chainhash.Hash) (btcutil.Address, string) {
	key, errKey := client.GetNextAttestationKey(hash)
	assert.Equal(t, nil, errKey)
	addr, script, nextAddrErr := client.GetNextAttestationAddr(key, hash)
	assert.Equal(t, nil, nextAddrErr)
	keyTest := client.GetKeyFromHash(hash)
	scriptTest, scriptErr := client.GetScriptFromHash(hash)
	assert.Equal(t, nil, scriptErr)
	assert.Equal(t, *key, keyTest)
	assert.Equal(t, script, scriptTest)
	importErr := client.ImportAttestationAddr(addr)
	assert.Equal(t, nil, importErr)
	return addr, script
}
verify key derivation and return address
package attestation
import (
	"encoding/hex"
	"errors"
	"math"
	"testing"
	"mainstay/clients"
	confpkg "mainstay/config"
	"mainstay/crypto"
	"mainstay/models"
	testpkg "mainstay/test"
	"github.com/btcsuite/btcd/btcjson"
	"github.com/btcsuite/btcd/chaincfg/chainhash"
	"github.com/btcsuite/btcd/wire"
	"github.com/btcsuite/btcutil"
	"github.com/stretchr/testify/assert"
)
const topupLevel = 3  
const iterNum = 5     
func createTopupUnspent(t *testing.T, config *confpkg.Config) chainhash.Hash {
	topupAddr, topupAddrErr := btcutil.DecodeAddress(config.TopupAddress(), config.MainChainCfg())
	assert.Equal(t, nil, topupAddrErr)
	topupTxHash, topupTxErr := config.MainClient().SendToAddress(topupAddr, 50*Coin)
	assert.Equal(t, nil, topupTxErr)
	return *topupTxHash
}
func getTopUpUnspent(t *testing.T, client *AttestClient, config *confpkg.Config, topupHash chainhash.Hash) btcjson.ListUnspentResult {
	success, unspent, errUnspent := client.findTopupUnspent()
	assert.Equal(t, true, success)
	assert.Equal(t, nil, errUnspent)
	assert.Equal(t, config.TopupAddress(), unspent.Address)
	assert.Equal(t, topupHash.String(), unspent.TxID)
	return unspent
}
func verifyCommitment(t *testing.T, sideClientFake *clients.SidechainClientFake) *models.Commitment {
	hash, _ := sideClientFake.GetBestBlockHash()
	commitment, errCommitment := models.NewCommitment([]chainhash.Hash{*hash})
	assert.Equal(t, nil, errCommitment)
	return commitment
}
func verifyFirstUnspent(t *testing.T, client *AttestClient) btcjson.ListUnspentResult {
	success, unspent, errUnspent := client.findTopupUnspent()
	assert.Equal(t, false, success)
	assert.Equal(t, nil, errUnspent)
	assert.Equal(t, btcjson.ListUnspentResult{}, unspent)
	success, unspent, errUnspent = client.findLastUnspent()
	assert.Equal(t, true, success)
	assert.Equal(t, nil, errUnspent)
	return unspent
}