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

use structured transaction in store and mempool #1146

Merged
merged 5 commits into from
Dec 11, 2024

Conversation

jchappelow
Copy link
Member

@jchappelow jchappelow commented Dec 11, 2024

Both the block store and mempool types were still using opaque transctions ([]byte) from the early version of the p2p demo. This updates both to use *types.Transaction.

This change stops short of updating the Block type to have a Txns []*Transaction field instead of Txns [][]byte, but that change should also be made. This can wait until the block data / chain RPCs are complete. It will also require updating the block serialization code, although the effective binary serialization will be identical.

This also updates the mempool implementation and interface:

  • internally there is a FIFO queue so that PeekN will return those at the front of the queue. The maps still remain there for fast indexing and existence checks.
  • add a Remove method that is the same as Store(txid, nil)

Copy link
Contributor

@charithabandi charithabandi left a comment

Choose a reason for hiding this comment

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

LGTM! Merge if you have no other changes.

@jchappelow jchappelow merged commit 684c2ef into kwilteam:main Dec 11, 2024
2 checks passed
@jchappelow jchappelow deleted the mempool-knows-txns branch December 11, 2024 21:08
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.

2 participants