Skip to content

[BUG] NewBUMPFromMerkleTreeAndIndex panics when index out of range #85

@boecklim

Description

@boecklim

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions