-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use estimated next block header in mempool validation #2033
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but please see the comment.
@@ -94,17 +94,18 @@ class UtxoStateSpecification extends ErgoPropertyTest with ErgoTransactionGenera | |||
) | |||
val unsignedTx = new UnsignedErgoTransaction(inputs, IndexedSeq(), newBoxes) | |||
val tx = ErgoTransaction(defaultProver.sign(unsignedTx, IndexedSeq(foundersBox), emptyDataBoxes, us.stateContext).get) | |||
val validationRes1 = us.validateWithCost(tx, 100000) | |||
val validationContext = us.stateContext.simplifiedUpcoming() | |||
val validationRes1 = us.validateWithCost(tx, Some(validationContext), 100000, None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like validateWithCost
is called everywhere with Some(validationContext)
.
Thus, us.stateContext.simplifiedUpcoming() probably can be called from validateWithCost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validateWithCost arguments simplified
In this PR, transaction validation context in mempool and API is now emulating next block (not last block mined as before).
For fields which can not be derived from the last block, following values are used:
close #2020