Skip to content

Commit

Permalink
fix SubscriptionRpc
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Dec 5, 2023
1 parent 2bd4163 commit 79635e1
Showing 3 changed files with 3 additions and 5 deletions.
3 changes: 2 additions & 1 deletion rpc/src/module/subscription.rs
Original file line number Diff line number Diff line change
@@ -196,8 +196,9 @@ impl SubscriptionRpc for SubscriptionRpcImpl {
Topic::ProposedTransaction => self.proposed_transaction_sender.clone(),
Topic::RejectedTransaction => self.new_reject_transaction_sender.clone(),
};
let mut rx = tx.subscribe();
Ok(Box::pin(async_stream::stream! {
while let Ok(msg) = tx.subscribe().recv().await {
while let Ok(msg) = rx.recv().await {
yield msg;
}
}))
2 changes: 1 addition & 1 deletion rpc/src/service_builder.rs
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ impl<'a> ServiceBuilder<'a> {
pub fn new(config: &'a RpcConfig) -> Self {
Self {
config,
io_handler: IoHandler::with_compatibility(jsonrpc_core::Compatibility::V2),
io_handler: IoHandler::default(),
}
}

3 changes: 0 additions & 3 deletions rpc/src/tests/setup.rs
Original file line number Diff line number Diff line change
@@ -35,9 +35,6 @@ const CELLBASE_MATURITY: u64 = 0;
const ALERT_UNTIL_TIMESTAMP: u64 = 2_524_579_200;

// Construct `Consensus` with an always-success cell
//
// It is similar to `util::test-chain-utils::always_success_consensus`, but with hard-code
// genesis timestamp.
pub(crate) fn always_success_consensus() -> Consensus {
let always_success_tx = always_success_transaction();
let dao = genesis_dao_data(vec![&always_success_tx]).unwrap();

0 comments on commit 79635e1

Please sign in to comment.