feat(network): add tx submission and tx monitor clients to network facades (#442)
* added txsubmission client to network facades * added txmonitor::client to network facades
This commit is contained in:
parent
07033ebf09
commit
520079d1f0
2 changed files with 20 additions and 2 deletions
|
|
@ -12,8 +12,9 @@ use tokio::net::{unix::SocketAddr as UnixSocketAddr, UnixListener};
|
||||||
use crate::miniprotocols::handshake::{n2c, n2n, Confirmation, VersionNumber};
|
use crate::miniprotocols::handshake::{n2c, n2n, Confirmation, VersionNumber};
|
||||||
|
|
||||||
use crate::miniprotocols::{
|
use crate::miniprotocols::{
|
||||||
blockfetch, chainsync, handshake, keepalive, localstate, txsubmission, PROTOCOL_N2C_CHAIN_SYNC,
|
blockfetch, chainsync, handshake, keepalive, localstate, localtxsubmission, txmonitor,
|
||||||
PROTOCOL_N2C_HANDSHAKE, PROTOCOL_N2C_STATE_QUERY, PROTOCOL_N2N_BLOCK_FETCH,
|
txsubmission, PROTOCOL_N2C_CHAIN_SYNC, PROTOCOL_N2C_HANDSHAKE, PROTOCOL_N2C_STATE_QUERY,
|
||||||
|
PROTOCOL_N2C_TX_MONITOR, PROTOCOL_N2C_TX_SUBMISSION, PROTOCOL_N2N_BLOCK_FETCH,
|
||||||
PROTOCOL_N2N_CHAIN_SYNC, PROTOCOL_N2N_HANDSHAKE, PROTOCOL_N2N_KEEP_ALIVE,
|
PROTOCOL_N2N_CHAIN_SYNC, PROTOCOL_N2N_HANDSHAKE, PROTOCOL_N2N_KEEP_ALIVE,
|
||||||
PROTOCOL_N2N_TX_SUBMISSION,
|
PROTOCOL_N2N_TX_SUBMISSION,
|
||||||
};
|
};
|
||||||
|
|
@ -285,6 +286,8 @@ pub struct NodeClient {
|
||||||
handshake: handshake::N2CClient,
|
handshake: handshake::N2CClient,
|
||||||
chainsync: chainsync::N2CClient,
|
chainsync: chainsync::N2CClient,
|
||||||
statequery: localstate::Client,
|
statequery: localstate::Client,
|
||||||
|
submission: localtxsubmission::Client,
|
||||||
|
monitor: txmonitor::Client,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NodeClient {
|
impl NodeClient {
|
||||||
|
|
@ -294,6 +297,8 @@ impl NodeClient {
|
||||||
let hs_channel = plexer.subscribe_client(PROTOCOL_N2C_HANDSHAKE);
|
let hs_channel = plexer.subscribe_client(PROTOCOL_N2C_HANDSHAKE);
|
||||||
let cs_channel = plexer.subscribe_client(PROTOCOL_N2C_CHAIN_SYNC);
|
let cs_channel = plexer.subscribe_client(PROTOCOL_N2C_CHAIN_SYNC);
|
||||||
let sq_channel = plexer.subscribe_client(PROTOCOL_N2C_STATE_QUERY);
|
let sq_channel = plexer.subscribe_client(PROTOCOL_N2C_STATE_QUERY);
|
||||||
|
let tx_channel = plexer.subscribe_client(PROTOCOL_N2C_TX_SUBMISSION);
|
||||||
|
let mo_channel = plexer.subscribe_client(PROTOCOL_N2C_TX_MONITOR);
|
||||||
|
|
||||||
let plexer = plexer.spawn();
|
let plexer = plexer.spawn();
|
||||||
|
|
||||||
|
|
@ -302,6 +307,8 @@ impl NodeClient {
|
||||||
handshake: handshake::Client::new(hs_channel),
|
handshake: handshake::Client::new(hs_channel),
|
||||||
chainsync: chainsync::Client::new(cs_channel),
|
chainsync: chainsync::Client::new(cs_channel),
|
||||||
statequery: localstate::Client::new(sq_channel),
|
statequery: localstate::Client::new(sq_channel),
|
||||||
|
submission: localtxsubmission::Client::new(tx_channel),
|
||||||
|
monitor: txmonitor::Client::new(mo_channel),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -406,6 +413,14 @@ impl NodeClient {
|
||||||
&mut self.statequery
|
&mut self.statequery
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn submission(&mut self) -> &mut localtxsubmission::Client {
|
||||||
|
&mut self.submission
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn monitor(&mut self) -> &mut txmonitor::Client {
|
||||||
|
&mut self.monitor
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn abort(self) {
|
pub async fn abort(self) {
|
||||||
self.plexer.abort().await
|
self.plexer.abort().await
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,9 @@ pub const PROTOCOL_N2C_TX_SUBMISSION: u16 = 6;
|
||||||
// Protocol channel number for node-to-client state queries
|
// Protocol channel number for node-to-client state queries
|
||||||
pub const PROTOCOL_N2C_STATE_QUERY: u16 = 7;
|
pub const PROTOCOL_N2C_STATE_QUERY: u16 = 7;
|
||||||
|
|
||||||
|
// Protocol channel number for node-to-client mempool monitor
|
||||||
|
pub const PROTOCOL_N2C_TX_MONITOR: u16 = 9;
|
||||||
|
|
||||||
/// A point within a chain
|
/// A point within a chain
|
||||||
#[derive(Clone, Eq, PartialEq, Hash)]
|
#[derive(Clone, Eq, PartialEq, Hash)]
|
||||||
pub enum Point {
|
pub enum Point {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue