Describe the bug
Currently the function NewBUMPFromMerkleTreeAndIndex() panics if index is out of range.
To Reproduce
Run the following test
func TestNewBUMPFromMerkleTreeAndIndex(t *testing.T) {
t.Run("index out of range", func(t *testing.T) {
_, _ = bc.NewBUMPFromMerkleTreeAndIndex(1, []*chainhash.Hash{{}}, 4)
})
}
Expected behavior
Function NewBUMPFromMerkleTreeAndIndex() validates the input and returns an error with descriptive error message, thereby avoiding any possible panics from happening in the function.
System Information (please complete the following information):
- Go version: 1.22.5
- go-bc version: github.com/libsv/go-bc v0.1.29