add more checks for impossible constraints #135
Merged
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.
If a single spend bundle has an
ASSERT_BEFORE_HEIGHT_ABSOLUTE
that's lower than or equal to anotherASSERT_HEIGHT_ABSOLUTE
, the spend bundle will never be valid.This patch checks for cases like this. Also for
_SECONDS_ABSOLUTE
.The
_RELATIVE
checks can only be made within the same Spend, since we don't actually know any absolute timestamps or confirmation heights for the coins.This is to catch a few obvious invalid cases early.
This still leaves non-obvious cases as successful (and must fail at a later state in the mempool pipeline).
For example, two different coins can have
ASSERT_HEIGHT_RELATIVE
andASSERT_BEFORE_HEIGHT_RELATIVE
that turn out to conflict, but we'll only know that once we look those coins up from the coin DB and know their confirmation heights.Another, more subtle, case of invalid spend bundles is where an
ASSERT_SECONDS_ABSOLUTE
conflicts with anASSERT_BEFORE_HEIGHT_ABSOLUTE
. Inchia_rs
we don't have any mapping between block height and (predicted) timestamps. Clearly we couldn't reject spend bundles based on predictions anyway, but there may be cases where aSECONDS
timestamp is known to refer to an old, existing, block. We won't catch those cases here either.