Skip to content

Commit

Permalink
Merge pull request nervosnetwork#4061 from eval-exec/exec/fix-request…
Browse files Browse the repository at this point in the history
…_proposal_txs-dedup

Fix `Relayer::request_proposal_txs`
  • Loading branch information
zhangsoledad authored Jul 6, 2023
2 parents ece7ad0 + 77a3271 commit 7fb84eb
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
16 changes: 13 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ members = [

[workspace.dependencies]
tempfile = "3"
itertools = "0.11.0"

[profile.release]
overflow-checks = true
Expand Down
2 changes: 1 addition & 1 deletion rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ckb-tx-pool = { path = "../tx-pool", version = "= 0.112.0-pre" }
ckb-memory-tracker = { path = "../util/memory-tracker", version = "= 0.112.0-pre" }
ckb-pow = { path = "../pow", version = "= 0.112.0-pre" }
ckb-indexer = { path = "../util/indexer", version = "= 0.112.0-pre" }
itertools = "0.10.5"
itertools.workspace = true
tokio = "1"

[dev-dependencies]
Expand Down
1 change: 1 addition & 0 deletions sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ bitflags = "1.0"
dashmap = "4.0"
keyed_priority_queue = "0.3"
sled = "0.34.7"
itertools.workspace = true

[dev-dependencies]
ckb-test-chain-utils = { path = "../util/test-chain-utils", version = "= 0.112.0-pre" }
Expand Down
9 changes: 5 additions & 4 deletions sync/src/relayer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ use ckb_types::{
prelude::*,
};
use ckb_util::Mutex;
use itertools::Itertools;
use std::collections::{HashMap, HashSet};
use std::sync::Arc;
use std::time::{Duration, Instant};
Expand Down Expand Up @@ -238,11 +239,11 @@ impl Relayer {
nc: &dyn CKBProtocolContext,
peer: PeerIndex,
block_hash_and_number: BlockNumberAndHash,
mut proposals: Vec<packed::ProposalShortId>,
proposals: Vec<packed::ProposalShortId>,
) {
proposals.dedup();
let tx_pool = self.shared.shared().tx_pool_controller();
let fresh_proposals = match tx_pool.fresh_proposals_filter(proposals) {
let fresh_proposals: Vec<ProposalShortId> = match tx_pool.fresh_proposals_filter(proposals)
{
Err(err) => {
debug_target!(
crate::LOG_TARGET_RELAY,
Expand All @@ -251,7 +252,7 @@ impl Relayer {
);
return;
}
Ok(fresh_proposals) => fresh_proposals,
Ok(fresh_proposals) => fresh_proposals.into_iter().unique().collect(),
};

let to_ask_proposals: Vec<ProposalShortId> = self
Expand Down

0 comments on commit 7fb84eb

Please sign in to comment.