Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
boecklim opened this issue Jan 9, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@boecklim
Copy link
Collaborator

boecklim commented Jan 9, 2025

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
@boecklim boecklim added the bug Something isn't working label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant