feat(miniprotocols): Implement tx submission client (#220)

* feat(miniprotocols): Implement tx submission client

* Match CDDL specs

* Fix build errors

* Add server implementation for txsubmission

Also includes some documentation for how to use both the client and the server

* cargo fmt

* clippy suggestions

clippy pls

* Fail explicitly on missing n2c unix socket

---------

Co-authored-by: Pi Lanningham <pi@sundaeswap.finance>
This commit is contained in:
Santiago Carmuega 2023-02-04 02:38:12 +01:00 committed by GitHub
parent 5edb456c70
commit 16d0211c5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 785 additions and 355 deletions

View file

@ -54,7 +54,7 @@ fn do_chainsync(channel: multiplexer::StdChannel) {
log::info!("rolling forward, block size: {}", h.len())
}
chainsync::NextResponse::RollBackward(x, _) => log::info!("rollback to {:?}", x),
chainsync::NextResponse::Await => log::info!("tip of chaing reached"),
chainsync::NextResponse::Await => log::info!("tip of chain reached"),
};
}
}
@ -66,8 +66,12 @@ fn main() {
// we connect to the unix socket of the local node. Make sure you have the right
// path for your environment
#[cfg(target_family = "unix")]
let bearer = Bearer::connect_unix("/tmp/node.socket").unwrap();
#[cfg(not(target_family = "unix"))]
panic!("can't use n2c unix socket on non-unix systems");
// setup the multiplexer by specifying the bearer and the IDs of the
// miniprotocols to use
let mut plexer = multiplexer::StdPlexer::new(bearer);