Skip to content

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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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