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.
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
Custom transactions from JDC removed from mempool during update #868
Custom transactions from JDC removed from mempool during update #868
Changes from 5 commits
c1fddcd
4a0200d
1a0a239
b30e5eb
5c7d0e3
cbfd11f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
do we need to call
mempool.safe_lock
in each iteration? couldnt we retrieveshort_ids_map
before thefor
and just use it?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.
This was a feedback from lorban I implemented and modified. If you have a better approach I can compare that
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.
@jbesraa is right
the better approach is to get
short_ids_map
once for all outside the loop, namelyright before the
for cycle. If you do not succeed in a reasonable time ask help to me or @jbesraa
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.
That means I would still need to handle the double unwraps well? @lorbax
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.
yes, but I suggest first to write a the code as easy as possible, thest it, then add error handling and then test it deeply. You should check that the code you introduced does what it is supposed to do. In particular, the old job must be removed from jds mempool and while updating the jds mempool the fat transactions are not discarded.
You can do that using testnet4, or a custom signet
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.
I'm worried that to_short_ids is very expensive not sure if is really better to lock the mutex for all that time. Btw we should have a benchmark for cases where there is contention for the lock.
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.
this should look into the new received DeclareMiningJob and remove only the txs that are in the old one but not in the new one. Also better would be to have a rc for each txs and decrement it everytime that the tx is in the old one and not in the new one (this cause we have multiple downstreams). And when we reach 0 we remove the tx
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.
somthing like that:
pub mempool: HashMap<Txid, Option<(Transaction,u64)>>
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.
I implemented this suggestion here plebhash@d5ec026
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.
Could we take advantage of the
token
or other property inJobDeclaratorDownstream
in order to do that?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.
Can you remove this info log ?
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.
okay, I will