Fix rpc-error due to quick transaction lookup#1159
Fix rpc-error due to quick transaction lookup#1159spacebear21 merged 1 commit intopayjoin:masterfrom
Conversation
|
Is this issue reproducible in the e2e tests? It would be nice to add an assertion that fails before this patch and succeeds with the patch - otherwise this timeout will get removed by someone else in a few months when we've forgotten why it was added. |
|
The time delay is making the test take forever as it blocks the entire tokio runtime . i'll figure out a diff approach |
|
"By default, the ZeroMQ feature is automatically compiled in if the necessary prerequisites are found" Are the necessary prereqs typically found? Waiting for an event is definitely the 'right' way to do this, but a much shorter timeout, even a function that polls on a much shorter timeout, would also be a hack I'm ok with merging. |
718e33f to
731ec24
Compare
Pull Request Test Coverage Report for Build 18781657652Details
💛 - Coveralls |
There was a problem hiding this comment.
A single timeout is gonna be too flaky and take a long time. IMO what you want is a separate method that loops on a small delay (~200ms) between making calls, and times out after looping for a longer time (~10s) and the timeout produces an error. A little polling code complexity will make a far more robust call for various platforms.
ff92353 to
bf7e789
Compare
i've pondered on this and haven't been able to figure out how to trigger this in e2e |
spacebear21
left a comment
There was a problem hiding this comment.
The quick-lookup error only occurs when the receiver is not interrupted prior to monitoring. In the e2e test, the receiver is interrupted then resumed after the sender has processed the payjoin tx. I think we should be able to reproduce the error in a e2e test that does not interrupt and resume the receiver and does a synchronous payjoin.
payjoin-cli/src/app/v2/mod.rs
Outdated
| // Check if we've exceeded the wait time | ||
| // since the payment will eventually come through, wondering if i should just remove this check | ||
| if start.elapsed() >= timeout_duration { | ||
| return Err(anyhow!( | ||
| "Timeout waiting for payment confirmation after {:?}", | ||
| timeout_duration | ||
| )); | ||
| } | ||
|
|
There was a problem hiding this comment.
This check is necessary in a production implementation because the payment is not guaranteed to come through if the sender doesn't broadcast it. Instead of erroring out completely we could e.g. prompt the user on whether they want to broadcast the fallback transaction, or wait longer for the payjoin transaction. However we could do this in a follow-up PR after this bug is fixed.
payjoin-cli/src/app/v2/mod.rs
Outdated
|
|
||
| match result { | ||
| Ok(_) => { | ||
| println!("Payment confirmed!"); |
There was a problem hiding this comment.
| println!("Payment confirmed!"); | |
| println!("Payjoin transaction {txid} detected in the mempool!"); |
There was a problem hiding this comment.
will a simple "payjoin transaction detected in the mempool" work ? , getting the txid outside checkpayment function scope will need changes to the api , making private fields public
bf7e789 to
0944820
Compare
This pr addresses an error that occurs due to rpc client looking up the transaction right before it's on chain . Error: Transient error: Implementation error: Obtained failure status(500): Internal Server Error The delay introduced allows the transaction to broadcasted on chain before the lookup fix format issue fix long pooling test Implement pooling mechanism for transaction check Implement pooling mechanism for transaction check fix rpc error fix rpc error fix lint error
0944820 to
dc9c4f4
Compare
| // keep polling | ||
|
|
There was a problem hiding this comment.
nit: unnecessary lines
This pr addresses an error that occurs due to rpc client looking up the transaction right before it's on chain . Error: Transient error: Implementation error: Obtained failure status(500): Internal Server Error
The delay introduced allows the transaction to broadcasted on chain before the lookup
This closes #1154
Pull Request Checklist
Please confirm the following before requesting review:
AI
in the body of this PR.