Fix EscrowFinish fulfillment and condition parsing #512
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.
Fixes #513
As seen in transaction
138543329687544CDAFCD3AB0DCBFE9C4F8E710397747BA7155F19426F493C8D
, sometimesEscrowFinish
transactions can show up in validated ledger transaction sets with an invalid fulfillment or condition. We added afulfillmentRawValue
andconditionRawValue
, and normalization functions to try to makefulfillment()
equivalent tofulfillmentRawValue
andcondition()
equivalent toconditionRawValue
in #483. However, we missed a special case where the fulfillment or condition could be well formed in the first 32 bytes, but contain extra bytes afterward (in the case of 138543329687544CDAFCD3AB0DCBFE9C4F8E710397747BA7155F19426F493C8D, the fulfillment is duplicated), which causes an exception to be thrown by the normalization function.This PR fixes this issue by checking that the parsed fulfillment or condition is equivalent to the fulfillment/condition raw value. If it is not equivalent, we will not set
fulfillment
orcondition
. If it is, we will.