-
Notifications
You must be signed in to change notification settings - Fork 27
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
Refactor unapplied transaction queue #295
Conversation
Refactor incoming trx handling
…actions in progress
…te trx instead of partial trace.
…tion to be notified
Reorder return_failure_trace flag in structure to match method order
…ilure_trace in unapplied trx queue. Add producer plugin test for trxs
Fix merge issues
…end, in unit tests
{ trx, expiry, persist_until_expired ? trx_enum_type::incoming_persisted : trx_enum_type::incoming, return_failure_trace, std::move( next ) } ); | ||
if( insert_itr.second ) added( insert_itr.first ); | ||
} else { | ||
if( !(itr->trx_meta == trx) && next ) { |
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.
Not sure that this logic makes sense, and the comment on the next line seems wrong. I think at the very least we should return whether or not next is defined here (and will we ever not have next set??).
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.
Updated
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.
Updated
…as to keep it around in case it was aborted, but it would be removed as a duplicate on next speculative block anyway, so it is meaningless to keep it. Simplify add_incoming. add_incoming should never change persist_until_expired or return_failure_trace flags, so just report duplicate. No need to update anything.
unapplied_transaction_queue
.unapplied_transaction_queue
used to have aprocess_mode
where it would not store aborted or forked-out transactions when it knew that the node would never produce a block. This was an optimization because there seemed to be no reason to cache aborted or forked-out transactions. Since the trx has been validated locally and will not be validated again, why keep it around? If you are producing you need to keep it so on a fork-switch the trxs are not lost. But there seemed to be no reason to keep them for speculative mode. However, theunapplied_transaction_queue
is also used when validating a block to look up already validated and constructedtransaction_metadata
. Keeping the already validated trxs in the queue allows for faster validation of received blocks for all the transactions already received by the node.last-block-time-offset-us
which doesn't really make any sense since the block is only speculative and will not be broadcast on the network. With this PR, all speculative blocks use theproduce-time-offset-us
including the 12th block.Resolves: #205