-
Notifications
You must be signed in to change notification settings - Fork 107
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
test(grpc): GetMempoolTx
and GetMempoolStream
test
#4537
Changes from 4 commits
e8f33d4
b69d0fd
c078c4d
e3ba20d
43f8f7f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,6 +124,40 @@ pub async fn run() -> Result<()> { | |
assert_eq!(response, expected_response); | ||
} | ||
|
||
// We test mempool grpc calls here as we know we have mempool transactions | ||
|
||
// Transactions can be in the RPC queue, lets wait until they are retired | ||
// before checking the mempool. | ||
tokio::time::sleep(tokio::time::Duration::from_secs(120)).await; | ||
|
||
// Call `GetMempoolStream` | ||
let mut response = rpc_client | ||
.get_mempool_stream(wallet_grpc::Empty {}) | ||
.await? | ||
.into_inner(); | ||
|
||
// Make sure transactions are returned from the mmepool | ||
let mut counter = 0; | ||
while let Some(_txs) = response.message().await? { | ||
counter += 1; | ||
} | ||
assert!(counter > 0); | ||
teor2345 marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This assertion might be failing because lightwalletd is still syncing when the transactions are sent. When lightwalletd finishes syncing, it looks like it clears its internal mempool cache, so transactions are no longer available to clients. (It should eventually re-check the mempool and get the transactions again. But the test will still be unreliable, because it doesn't wait.)
https://github.com/ZcashFoundation/zebra/runs/7605046338?check_suite_focus=true#step:6:269 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I opened ticket #4894 to fix this. |
||
|
||
// Call `GetMempoolTx` | ||
let mut response = rpc_client | ||
.get_mempool_tx(wallet_grpc::Exclude { txid: vec![] }) | ||
.await? | ||
.into_inner(); | ||
|
||
// Make sure transactions are returned from the mmepool | ||
let mut counter = 0; | ||
while let Some(_txs) = response.message().await? { | ||
counter += 1; | ||
} | ||
// TODO: It seems to be a bug in `GetMempoolTx` as the grpc is not returning transactions | ||
teor2345 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// but we know there are transactions in the mempool as they are returned by `GetMempoolStream` test above. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you tried calling the RPCs in the opposite order? |
||
assert!(counter == 0); | ||
|
||
Ok(()) | ||
} | ||
|
||
|
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.