From 47ea1f3ae045e1f616bc5afd92af14ef54386fe6 Mon Sep 17 00:00:00 2001 From: "zero.qn" Date: Thu, 28 Jul 2022 18:22:17 +0800 Subject: [PATCH] fix(tests): wait withdrawal push to mem pool --- .../tests/rpc_server/submit_withdrawal_request.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/tests/src/tests/rpc_server/submit_withdrawal_request.rs b/crates/tests/src/tests/rpc_server/submit_withdrawal_request.rs index 2ac5c1a1b..147f55535 100644 --- a/crates/tests/src/tests/rpc_server/submit_withdrawal_request.rs +++ b/crates/tests/src/tests/rpc_server/submit_withdrawal_request.rs @@ -1,3 +1,5 @@ +use std::time::Duration; + use gw_common::{ builtins::{CKB_SUDT_ACCOUNT_ID, ETH_REGISTRY_ACCOUNT_ID}, ckb_decimal::CKBCapacity, @@ -92,16 +94,14 @@ async fn test_submit_withdrawal_request() { .await .unwrap(); - let is_in_queue = rpc_server + while rpc_server .is_request_in_queue(withdrawal_hash) .await - .unwrap(); - - if !is_in_queue { - chain.produce_block(vec![], vec![withdrawal]).await.unwrap(); - } else { - chain.produce_block(vec![], vec![]).await.unwrap(); + .unwrap() + { + tokio::time::sleep(Duration::from_millis(100)).await; } + chain.produce_block(vec![], vec![withdrawal]).await.unwrap(); let snap = mem_pool_state.load(); let state = snap.state().unwrap();