Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
2dc5c35
txpool reimpled
ControlCplusControlV Sep 3, 2022
3ab7525
Tests go green
ControlCplusControlV Sep 3, 2022
3cc1ae2
clippy
ControlCplusControlV Sep 3, 2022
40e0384
final touches?
ControlCplusControlV Sep 3, 2022
beca66d
clippy fix
ControlCplusControlV Sep 4, 2022
68e21fa
clippy maybe?
ControlCplusControlV Sep 4, 2022
9b56bd8
Merge branch 'master' into controlc/p2p_tx
ControlCplusControlV Sep 6, 2022
d866c11
Merge branch 'master' into controlc/p2p_tx
ControlCplusControlV Sep 9, 2022
716a3fa
updated fmt
ControlCplusControlV Sep 9, 2022
e248f8c
ci passes?
ControlCplusControlV Sep 9, 2022
d8edc4f
Merge branch 'master' into controlc/p2p_tx
ControlCplusControlV Sep 12, 2022
bf32dad
Merge branch 'master' into controlc/p2p_tx
ControlCplusControlV Sep 17, 2022
cd62488
Merge branch 'master' into controlc/p2p_tx
bvrooman Sep 20, 2022
3c3f514
Error when tx_receiver channel sender is dropped
bvrooman Sep 20, 2022
e9b8cc4
Updated fmt
bvrooman Sep 21, 2022
06d0e6b
Spelling
bvrooman Sep 21, 2022
5a2e7a6
Update modules channel wiring
bvrooman Sep 23, 2022
afaa697
Merge branch 'master' into controlc/p2p_tx
ControlCplusControlV Sep 23, 2022
386e073
Keep alive for incoming_tx_sender
bvrooman Sep 23, 2022
afcf626
Merge branch 'controlc/p2p_tx' of https://github.com/FuelLabs/fuel-co…
bvrooman Sep 23, 2022
58034a3
Update features config and tests
bvrooman Sep 23, 2022
41669d3
Revert unrelated change
bvrooman Sep 23, 2022
64dd2e3
Merge branch 'master' into controlc/p2p_tx
ControlCplusControlV Sep 24, 2022
03300f8
test issues now
ControlCplusControlV Sep 24, 2022
58f4654
fixes
ControlCplusControlV Sep 24, 2022
84f0e18
fmt
ControlCplusControlV Sep 24, 2022
a081d96
was it that easy?
ControlCplusControlV Sep 24, 2022
a6c942c
oops
ControlCplusControlV Sep 24, 2022
f0ea4ba
New testcase for tx gossip
ControlCplusControlV Sep 25, 2022
68c780f
Fmt
bvrooman Sep 26, 2022
de0e154
Test p2p connection and integ
bvrooman Sep 26, 2022
db0bb65
add tx gossip to default topics
Voxelot Sep 26, 2022
4e1946c
Merge branch 'master' into controlc/p2p_tx
ControlCplusControlV Sep 27, 2022
a2498d7
Clean up use statements and dbg
bvrooman Sep 27, 2022
2f2e7d0
Refactor node_config
bvrooman Sep 27, 2022
93c3890
Simplify gossip test mod with feature flag
bvrooman Sep 27, 2022
d4e2fac
Remove readme changes
bvrooman Sep 29, 2022
df2fe70
Minor cleanup
bvrooman Sep 29, 2022
fe89f69
Minor cleanup
bvrooman Sep 29, 2022
cb7fcda
Add all gossip topics to default p2p config
bvrooman Sep 29, 2022
f63683a
Fix
bvrooman Sep 29, 2022
9b79b61
Merge branch 'master' into controlc/p2p_tx
bvrooman Sep 29, 2022
4a2346c
Clean up txpool cargo
bvrooman Sep 29, 2022
e1da109
Merge branch 'controlc/p2p_tx' of https://github.com/FuelLabs/fuel-co…
bvrooman Sep 29, 2022
be1a152
Remove debug statements
bvrooman Sep 29, 2022
b9a7812
Merge branch 'master' into controlc/p2p_tx
ControlCplusControlV Sep 30, 2022
427c4d8
Merge branch 'master' into controlc/p2p_tx
ControlCplusControlV Oct 1, 2022
c37a8c6
Remove Feature Flags from Tx Gossiping (#664)
ControlCplusControlV Oct 2, 2022
6a18f94
Refactor insert_with_broadcast
bvrooman Oct 3, 2022
96448f2
Merge branch 'master' into bvrooman/refactor/broadcast_tx_insert
bvrooman Oct 6, 2022
91fea79
Remove insert_with_broadcast
bvrooman Oct 6, 2022
c1ecf93
Simplify
bvrooman Oct 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions fuel-txpool/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,11 @@ impl ServiceBuilder {
|| self.txpool_sender.is_none()
|| self.tx_status_sender.is_none()
|| self.txpool_receiver.is_none()
|| self.network_sender.is_none()
{
return Err(anyhow!("One of context items are not set"))
}

if self.network_sender.is_none() {
return Err(anyhow!("P2P network sender is not set"))
}

let service = Service::new(
self.txpool_sender.unwrap(),
self.tx_status_sender.clone().unwrap(),
Expand Down Expand Up @@ -209,9 +206,19 @@ impl Context {
let _ = response.send(TxPool::includable(txpool).await);
}
TxPoolMpsc::Insert { txs, response } => {
let _ = response.send(TxPool::insert_with_broadcast(txpool, db.as_ref().as_ref(), tx_status_sender, network_sender, txs).await);
let insert = TxPool::insert(txpool, db.as_ref().as_ref(), tx_status_sender,txs.clone()).await;
for (ret, tx) in insert.iter().zip(txs.into_iter()) {
match ret {
Ok(_) => {
let _ = network_sender.send(P2pRequestEvent::BroadcastNewTransaction {
transaction: tx.clone(),
}).await;
}
Err(_) => {}
}
}
let _ = response.send(insert);
}

TxPoolMpsc::Find { ids, response } => {
let _ = response.send(TxPool::find(txpool,&ids).await);
}
Expand Down
44 changes: 0 additions & 44 deletions fuel-txpool/src/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ use tokio::sync::{
RwLock,
};

use fuel_core_interfaces::p2p::P2pRequestEvent;
use tokio::sync::mpsc;

#[derive(Debug, Clone)]
pub struct TxPool {
by_hash: HashMap<TxId, TxInfo>,
Expand Down Expand Up @@ -148,47 +145,6 @@ impl TxPool {
Ok(())
}

pub async fn insert_with_broadcast(
txpool: &RwLock<Self>,
db: &dyn TxPoolDb,
tx_status_sender: broadcast::Sender<TxStatusBroadcast>,
network_sender: mpsc::Sender<P2pRequestEvent>,
txs: Vec<ArcTx>,
) -> Vec<anyhow::Result<Vec<ArcTx>>> {
let mut res = Vec::new();
for tx in txs.iter() {
let mut pool = txpool.write().await;
res.push(pool.insert_inner(tx.clone(), db).await)
}
for (ret, tx) in res.iter().zip(txs.into_iter()) {
match ret {
Ok(removed) => {
for removed in removed {
let _ = tx_status_sender.send(TxStatusBroadcast {
tx: removed.clone(),
status: TxStatus::SqueezedOut {
reason: Error::Removed,
},
});
}
let _ = tx_status_sender.send(TxStatusBroadcast {
tx: tx.clone(),
status: TxStatus::Submitted,
});
let _ = network_sender
.send(P2pRequestEvent::BroadcastNewTransaction {
transaction: tx.clone(),
})
.await;
}
Err(_) => {
// @dev should not broadcast tx if error occurred
}
}
}
res
}

/// Import a set of transactions from network gossip or GraphQL endpoints.
pub async fn insert(
txpool: &RwLock<Self>,
Expand Down