Skip to content

Conversation

arvidn
Copy link
Contributor

@arvidn arvidn commented Jul 31, 2025

if the coin doesn't appear to support the rebasing

Purpose:

In #19713 we introduced the optimization of using spent_index = -1 to indicate whether a coin's parent has the same puzzle hash and amount. When accepting a FF spend into the mempool, we need to ensure that it will be possible to rebase it on top of the latest version (otherwise the mempool may have invalid spends in it, wasting space).

In #19272, any spend submitted to the mempool, that supports fast forward, is checked that the coin it's spending has spent_index = -1. If not, the spend is rejected as DOUBLE_SPEND.

There's a problem with migration, since older nodes will have just left the spent_index = 0, even if coins support fast forward. Attempting to submit a FF spend to a new node with an old database will fail with this error.

This patch, instead, turns the spend into a normal spend. Not marking it as eligible for FF means the coin it's spending actually have to be unspent. This solves the transition problem as long as only one spend at a time happens first.

i.e. in the scenario of a new node with an old database, only a single FF spend will go through at first. Once the FF singleton has been spent once, FF will be fully enabled, since the new coin will have spent_index = -1 set in the node's database.

Current Behavior:

New Behavior:

Testing Notes:

@arvidn arvidn requested a review from AmineKhaldi August 1, 2025 01:55
@arvidn arvidn added the Fixed Required label for PR that categorizes merge commit message as "Fixed" for changelog label Aug 1, 2025
@arvidn arvidn marked this pull request as ready for review August 1, 2025 14:42
@arvidn arvidn requested a review from a team as a code owner August 1, 2025 14:42
Copy link
Contributor

@wjblanke wjblanke left a comment

Choose a reason for hiding this comment

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

aok

@pmaslana pmaslana merged commit b1cc0a5 into release/2.5.5 Aug 1, 2025
2203 of 2211 checks passed
@pmaslana pmaslana deleted the ff-fix2 branch August 1, 2025 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Fixed Required label for PR that categorizes merge commit message as "Fixed" for changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants