func NewCommitment(commitments []chainhash.Hash) (*Commitment, error) {
	if len(commitments) == 0 {
		return nil, errors.New(ErrorCommitmentListEmpty)
	}
	commitmentTree := NewCommitmentMerkleTree(commitments)
	return &Commitment{commitmentTree}, nil
}
Return new Commitment instance
package models
import (
	"errors"
	"github.com/btcsuite/btcd/chaincfg/chainhash"
	"go.mongodb.org/mongo-driver/bson"
)
const (
	ErrorCommitmentListEmpty = "List of commitments is empty"
)
type Commitment struct {
	tree CommitmentMerkleTree
}