func (d *DbFake) SaveMerkleProofs(proofs []models.CommitmentMerkleProof) error {
	var newProofs []models.CommitmentMerkleProof
	for _, proof := range proofs {
		found := false
		for i, p := range d.MerkleProofs {
			if p.Commitment == proof.Commitment &&
				p.ClientPosition == proof.ClientPosition &&
				p.MerkleRoot == proof.MerkleRoot {
				found = true
				d.MerkleProofs[i] = proof
				break
			}
		}
		if !found {
			newProofs = append(newProofs, proof)
		}
	}
	d.MerkleProofs = append(d.MerkleProofs, newProofs...)
	return nil
}
Save merkle proofs to the MerkleProof collection
package db
import (
	"errors"
	"mainstay/models"
	"github.com/btcsuite/btcd/chaincfg/chainhash"
)
type DbFake struct {
	Attestations      []models.Attestation
	AttestationsInfo  []models.AttestationInfo
	MerkleCommitments []models.CommitmentMerkleCommitment
	MerkleProofs      []models.CommitmentMerkleProof
	latestCommitments []models.ClientCommitment
}
func NewDbFake() *DbFake {
	return &DbFake{
		[]models.Attestation{},
		[]models.AttestationInfo{},
		[]models.CommitmentMerkleCommitment{},
		[]models.CommitmentMerkleProof{},
		[]models.ClientCommitment{}}
}
func (d *DbFake) SaveAttestation(attestation models.Attestation) error {
	for i, a := range d.Attestations {
		if a.Txid == attestation.Txid {
			d.Attestations[i] = attestation
			return nil
		}
	}
	d.Attestations = append(d.Attestations, attestation)
	return nil
}
func (d *DbFake) SaveAttestationInfo(attestationInfo models.AttestationInfo) error {
	for i, a := range d.AttestationsInfo {
		if a.Txid == attestationInfo.Txid {
			d.AttestationsInfo[i] = attestationInfo
			return nil
		}
	}
	d.AttestationsInfo = append(d.AttestationsInfo, attestationInfo)
	return nil
}
func (d *DbFake) SaveMerkleCommitments(commitments []models.CommitmentMerkleCommitment) error {
	var newCommitments []models.CommitmentMerkleCommitment
	for _, commitment := range commitments {
		found := false
		for i, c := range d.MerkleCommitments {
			if c == commitment {
				found = true
				d.MerkleCommitments[i] = commitment
				break
			}
		}
		if !found {
			newCommitments = append(newCommitments, commitment)
		}
	}
	d.MerkleCommitments = append(d.MerkleCommitments, newCommitments...)
	return nil
}