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

fix: bump order in BEEF creation #59

Merged

Conversation

jakubmkowalski
Copy link
Contributor

This implementation fixes a problem related to randomly writing BUMPs to the BEEF Hex
As stated in the documentation:
When iterating over a map with a range loop, the iteration order is not specified and is not guaranteed to be the same from one iteration to the next.

This pull request includes changes to the BEEF method in the transaction/beef.go file to improve the handling of MerklePath objects. The most important changes include switching from a map to a slice for bumps and adjusting the logic to use the new data structure.

Improvements to BEEF method:

  • Changed the bumps variable from a map to a slice of *MerklePath to simplify the data structure.
  • Updated the logic to use bumpIndex for tracking indices in the bumps slice, replacing the previous map-based approach.

Copy link
Collaborator

@rohenaz rohenaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

Copy link
Collaborator

@shruggr shruggr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@rohenaz rohenaz merged commit 3c5bd7f into bitcoin-sv:master Nov 26, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants