-
Notifications
You must be signed in to change notification settings - Fork 43
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
Relax error propagation for batch loading mempool txs #64
Conversation
@@ -506,13 +538,12 @@ impl Daemon { | |||
.iter() | |||
.map(|txhash| json!([txhash.to_hex(), /*verbose=*/ false])) | |||
.collect(); | |||
|
|||
let values = self.requests("getrawtransaction", ¶ms_list)?; | |||
let values = self.retry_request_batch("getrawtransaction", ¶ms_list, 0.25)?; |
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.
- Magic number / arbitrary value.
- This doesn't feel like it should be set here.
At the very least we need a TODO to properly bubble this up the call stack and make it into a startup config param or something.
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.
utACK 9380493
Ok(parsed_reply) => results.push(parsed_reply), | ||
Err(e) => { | ||
failed_requests += 1; | ||
warn!( |
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.
Maybe lower to debug level... it is expected to be frequent...
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.
Tested ACK @ 36d1f7f
…atching Relax error propagation for batch loading mempool txs
If the initial batched mempool load takes too long, some of the transactions are likely to have been removed from the mempool (replaced or evicted) by the time we request them.
Currently, any missing transaction in the whole batch results in an error that propagates up to fail the entire gettransactions result, which can make it almost impossible to make progress.
This PR allows individual transaction requests in each batch RPC chunk to fail without failing the whole request. Those failed txs are simply filtered out of the response, and can just be fetched on the next mempool update (if they still exist).
If more than 25% of requests fail, we do still abort the request, and bubble up the last error.
This required relaxing the
assert_eq!(txhashes.len(), txs.len())
assertion ingettransactions
, and I suppose it could potentially also cause issues with missing parents etc, so I'm not really sure how safe this is 🫤