Skip to content

Conversation

@Davidson-Souza
Copy link
Collaborator

Before this change, modify would return the data needed to update a proof for the new block. This requires additional internal computation and extra allocations. During IBD we may never use this, since proof update is only meant for updating a few blocks worth of changes. Now there's a method specific to pull the modify_data, and modify itself will only return a new Stump.

When refactoring the addition function, I've modified it a little to allow a smarter one with a very nice property: it can pretend that it added a node, but actually represent it as deleted. The goal here is to do a Swift Sync-style protocol where you don't need deletions.

If a txout is already spent, you give an empty hash (BitcoinNodeHash::empty()). This will be exactly equivalent as giving this txo's hash and later on calling delete for with this txo's hash. However, it does this with only one call to modify and doesn't require proofs to achieve that.

This is an API breaking change, as modify now only returns one parameter, otherwise the behavior stays unchanged.

@Davidson-Souza Davidson-Souza marked this pull request as ready for review January 2, 2026 17:40
Before this change, `modify` would return the data needed to update
a proof for the new block. This requires additional internal
computation and extra allocations. During IBD we may never use this,
since proof update is only meant for updating a few blocks worth of
changes. Now there's a method specific to pull the modify_data, and
`modify` itself will only return a new Stump.

When refactoring the addition function, I've modified it a little
to allow a smarter one with a very nice property: it can pretend that
it added a node, but actually represent it as deleted. The goal here
is to do a Swift Sync-style protocol where you don't need deletions.

If a txout is already spent, you give an empty hash
(BitcoinNodeHash::empty()). This will be exactly equivalent as giving
this txo's hash and later on calling delete for with this txo's hash.
However, it does this with only one call to modify and doesn't require
proofs to achieve that.

This is an API breaking change, as modify now only returns one parameter,
otherwise the behavior stays unchanged.
@Davidson-Souza
Copy link
Collaborator Author

Pushed 427a309 with minor docs updates suggested by @jaoleal

@luisschwab
Copy link
Contributor

@Davidson-Souza do you have a Floresta branch using this PR?

@Davidson-Souza
Copy link
Collaborator Author

@luisschwab

@Davidson-Souza do you have a Floresta branch using this PR?

No, waiting on Jose's pr with swift sync stuff

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.

3 participants