Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch adds a feature flag to disallow relative timelock conditions on ephemeral spends. As relative timelock, we count:
These are condition that, indirectly, depend on the current block's height and timestamp. Since we're only considering ephemeral spends.
This patch is split up into 3 commits, best reviewed one at a time.
commit 1
The first commit is really a clean-up of the previous
ASSERT_EPHEMERAL
condition, where instead of recording (parent, puzzle-hash, amount) for coins asserting they're ephemeral, we just record the index of that spend, in the list of spends we're building while parsing. This in the periphery of the core change, but since we'll need to also record coins that are not allowed to be ephemeral, having a simpler and more compact representation helps.commit 2
This first step records whether a spend contains any relative timelocks. One interesting case is when a condition is automatically true, and dropped. This requires that we record the existence of the condition some other way. We do this with a flag. This affects some tests that currently check the flag, that now need to take into the account that this new flag may be set.
commit 3
This last step also adds the checking that spends with relative timelock conditions are in fact not ephemeral spends. For this we also need a new feature flag to enable this checking, since consensus rules may not be updated immediately, but needs a soft-fork height where it activates. We can activate it immediately in mempool mode however.