Skip to content

Fix partial transactions #247

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

Merged
merged 1 commit into from
May 29, 2025
Merged

Fix partial transactions #247

merged 1 commit into from
May 29, 2025

Conversation

n8maninger
Copy link
Member

No description provided.

@n8maninger n8maninger self-assigned this May 29, 2025
@github-project-automation github-project-automation bot moved this to In Progress in Sia May 29, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR corrects the selection of partial-block transactions by switching from using FullHash to MerkleLeafHash when matching requested transactions.

  • Updated syncer/peer.go to filter by MerkleLeafHash()
  • Updated chain/manager.go to filter by MerkleLeafHash()
  • Added a changeset file documenting the fix

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
syncer/peer.go Use MerkleLeafHash instead of FullHash when matching txns
chain/manager.go Use MerkleLeafHash instead of FullHash in transaction lookup
.changeset/...partial_blocks.md Documented the patch in the changeset file
Comments suppressed due to low confidence (3)

syncer/peer.go:347

  • [nitpick] The variable name want is ambiguous; consider renaming it to something like desiredLeafHashes to make its purpose clearer.
if want[txn.MerkleLeafHash()] {

chain/manager.go:884

  • [nitpick] The want map name is vague in this context; renaming it to targetLeafHashes or similar would improve readability.
if h := txn.MerkleLeafHash(); want[h] {

chain/manager.go:881

  • There are no tests covering the switch to using MerkleLeafHash() for partial-block retrieval; consider adding unit tests to verify correct behavior when matching by leaf hash.
// TODO: might want to cache these

Copy link
Member

@peterjan peterjan left a comment

Choose a reason for hiding this comment

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

wow 👀

@lukechampine
Copy link
Member

dang. Forgot about that interaction between the Manager and block outlines. :/

@lukechampine lukechampine merged commit 04fa531 into master May 29, 2025
12 checks passed
@lukechampine lukechampine deleted the nate/fix-syncer branch May 29, 2025 15:04
@github-project-automation github-project-automation bot moved this from In Progress to Done in Sia May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants