Yes, transactions are gossiped via libp2p networking. If you don't want to receive/send transactions via libp2p networking you need to change the following code:
let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) =
sc_service::build_network(sc_service::BuildNetworkParams {
config: &config,
client: client.clone(),
transaction_pool: transaction_pool.clone(),
spawn_handle: task_manager.spawn_handle(),
import_queue,
block_announce_validator_builder: None,
warp_sync_params: Some(WarpSyncParams::WithProvider(warp_sync)),
})?;
transaction_pool
is the thing you need to change. You will need to provide your own implementation of the TransactionPool
trait:
struct DummyTxPool;
impl<B> sc_network_transactions::config::TransactionPool<Block::Hash, B>
for DummyTxPool
where
B: BlockT,
{
fn transactions(&self) -> Vec<(H, B::Extrinsic)> {
// Don't propagate any transactions
vec![]
}
fn hash_of(&self, tx: &B::Extrinsic) -> H {
sp_runtime::traits::HashFor::<B>::hash_of(tx)
}
fn import(&self, _: B::Extrinsic) -> TransactionImportFuture {
// We just ignore the import request.
async { TransactionImport::None }.boxed()
}
fn on_broadcasted(&self, _: HashMap<H, Vec<String>>) {}
fn transaction(&self, _: &H) -> Option<B::Extrinsic> {
None
}
}
Then you need to set transaction_pool
to DummyTxPool
. If you maybe want to still propagate your own local transactions, you need to modify transactions
to return the ones you want to propagate.