Anwer tx-submission reqs in chain-sync examples
This commit is contained in:
parent
c3c7f818ce
commit
1bd7797d78
3 changed files with 13 additions and 12 deletions
|
|
@ -22,3 +22,4 @@ hex = "0.4.3"
|
|||
net2 = "0.2.37"
|
||||
env_logger = "0.9.0"
|
||||
pallas-handshake = { path = "../pallas-handshake/" }
|
||||
pallas-txsubmission = { path = "../pallas-txsubmission/" }
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
use net2::TcpStreamExt;
|
||||
use pallas_txsubmission::NaiveProvider;
|
||||
use std::net::TcpStream;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
use pallas_chainsync::{Consumer, Point};
|
||||
use pallas_handshake::n2c::{Client, VersionTable};
|
||||
|
|
@ -16,12 +19,17 @@ fn main() {
|
|||
bearer.set_nodelay(true).unwrap();
|
||||
bearer.set_keepalive_ms(Some(30_000u32)).unwrap();
|
||||
|
||||
let mut handles = Multiplexer::new(bearer, &vec![0, 5]).unwrap();
|
||||
let mut handles = Multiplexer::new(bearer, &vec![0, 4, 5]).unwrap();
|
||||
|
||||
let (_, rx, tx) = handles.remove(0);
|
||||
|
||||
let versions = VersionTable::v1_and_above(MAINNET_MAGIC);
|
||||
let last = run_agent(Client::initial(versions), rx, &tx).unwrap();
|
||||
println!("{:?}", last);
|
||||
println!("last hanshake state: {:?}", last);
|
||||
|
||||
let (_, ts_rx, ts_tx) = handles.remove(0);
|
||||
let ts = NaiveProvider::initial(vec![]);
|
||||
let ts = run_agent(ts, ts_rx, &ts_tx).unwrap();
|
||||
println!("last tx-submission state: {:?}", ts);
|
||||
|
||||
let known_points = vec![Point(
|
||||
43847831u64,
|
||||
|
|
@ -29,9 +37,7 @@ fn main() {
|
|||
)];
|
||||
|
||||
let (_, cs_rx, cs_tx) = handles.remove(0);
|
||||
|
||||
let cs = Consumer::initial(known_points);
|
||||
let cs = run_agent(cs, cs_rx, &cs_tx).unwrap();
|
||||
|
||||
println!("{:?}", cs);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,13 +154,7 @@ impl DecodePayload for Message {
|
|||
Ok(Message::RollBackward(point, tip))
|
||||
}
|
||||
4 => {
|
||||
let points_len = d
|
||||
.array()?
|
||||
.ok_or(MachineError::UnexpectedCbor("unbounded points array"))?;
|
||||
let mut points = Vec::with_capacity(points_len as usize);
|
||||
for i in 0..(points_len - 1) {
|
||||
points[i as usize] = Point::decode_payload(d)?;
|
||||
}
|
||||
let points = Vec::<Point>::decode_payload(d)?;
|
||||
Ok(Message::FindIntersect(points))
|
||||
}
|
||||
5 => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue