style: apply fmt to entire workspace
This commit is contained in:
parent
1b6cbbc095
commit
336d2400f4
23 changed files with 111 additions and 67 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
mod model;
|
|
||||||
mod framework;
|
mod framework;
|
||||||
|
mod model;
|
||||||
|
|
||||||
pub use framework::*;
|
pub use framework::*;
|
||||||
pub use model::*;
|
pub use model::*;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ impl<'b, const N: usize> minicbor::Decode<'b> for SkipCbor<N> {
|
||||||
impl<const N: usize> minicbor::Encode for SkipCbor<N> {
|
impl<const N: usize> minicbor::Encode for SkipCbor<N> {
|
||||||
fn encode<W: minicbor::encode::Write>(
|
fn encode<W: minicbor::encode::Write>(
|
||||||
&self,
|
&self,
|
||||||
e: &mut minicbor::Encoder<W>,
|
_e: &mut minicbor::Encoder<W>,
|
||||||
) -> Result<(), minicbor::encode::Error<W::Error>> {
|
) -> Result<(), minicbor::encode::Error<W::Error>> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,11 @@ use net2::TcpStreamExt;
|
||||||
use pallas_machines::primitives::Point;
|
use pallas_machines::primitives::Point;
|
||||||
use std::net::TcpStream;
|
use std::net::TcpStream;
|
||||||
|
|
||||||
use pallas_blockfetch::BlockFetchClient;
|
use pallas_blockfetch::{BatchClient, NoopObserver};
|
||||||
use pallas_handshake::{MAINNET_MAGIC, n2n::{Client, VersionTable}};
|
use pallas_handshake::{
|
||||||
|
n2n::{Client, VersionTable},
|
||||||
|
MAINNET_MAGIC,
|
||||||
|
};
|
||||||
use pallas_machines::run_agent;
|
use pallas_machines::run_agent;
|
||||||
use pallas_multiplexer::Multiplexer;
|
use pallas_multiplexer::Multiplexer;
|
||||||
|
|
||||||
|
|
@ -37,7 +40,7 @@ fn main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut bf_channel = muxer.use_channel(3);
|
let mut bf_channel = muxer.use_channel(3);
|
||||||
let bf = BlockFetchClient::initial(range);
|
let bf = BatchClient::initial(range, NoopObserver {});
|
||||||
let bf_last = run_agent(bf, &mut bf_channel);
|
let bf_last = run_agent(bf, &mut bf_channel);
|
||||||
println!("{:?}", bf_last);
|
println!("{:?}", bf_last);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -94,18 +94,25 @@ pub trait Observer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct NoopObserver {}
|
pub struct NoopObserver {}
|
||||||
|
|
||||||
impl Observer for NoopObserver {}
|
impl Observer for NoopObserver {}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct BatchClient<O> where O: Observer {
|
pub struct BatchClient<O>
|
||||||
|
where
|
||||||
|
O: Observer,
|
||||||
|
{
|
||||||
pub state: State,
|
pub state: State,
|
||||||
pub range: (Point, Point),
|
pub range: (Point, Point),
|
||||||
pub observer: O,
|
pub observer: O,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<O> BatchClient<O> where O: Observer {
|
impl<O> BatchClient<O>
|
||||||
|
where
|
||||||
|
O: Observer,
|
||||||
|
{
|
||||||
pub fn initial(range: (Point, Point), observer: O) -> Self {
|
pub fn initial(range: (Point, Point), observer: O) -> Self {
|
||||||
Self {
|
Self {
|
||||||
state: State::Idle,
|
state: State::Idle,
|
||||||
|
|
@ -128,7 +135,10 @@ impl<O> BatchClient<O> where O: Observer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<O> Agent for BatchClient<O> where O: Observer {
|
impl<O> Agent for BatchClient<O>
|
||||||
|
where
|
||||||
|
O: Observer,
|
||||||
|
{
|
||||||
type Message = Message;
|
type Message = Message;
|
||||||
|
|
||||||
fn is_done(&self) -> bool {
|
fn is_done(&self) -> bool {
|
||||||
|
|
@ -176,13 +186,19 @@ impl<O> Agent for BatchClient<O> where O: Observer {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct OnDemandClient<O> where O: Observer {
|
pub struct OnDemandClient<O>
|
||||||
|
where
|
||||||
|
O: Observer,
|
||||||
|
{
|
||||||
pub state: State,
|
pub state: State,
|
||||||
pub requests: Receiver<Point>,
|
pub requests: Receiver<Point>,
|
||||||
pub observer: O,
|
pub observer: O,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<O> OnDemandClient<O> where O: Observer {
|
impl<O> OnDemandClient<O>
|
||||||
|
where
|
||||||
|
O: Observer,
|
||||||
|
{
|
||||||
pub fn initial(requests: Receiver<Point>, observer: O) -> Self {
|
pub fn initial(requests: Receiver<Point>, observer: O) -> Self {
|
||||||
Self {
|
Self {
|
||||||
state: State::Idle,
|
state: State::Idle,
|
||||||
|
|
@ -207,7 +223,10 @@ impl<O> OnDemandClient<O> where O: Observer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<O> Agent for OnDemandClient<O> where O: Observer {
|
impl<O> Agent for OnDemandClient<O>
|
||||||
|
where
|
||||||
|
O: Observer,
|
||||||
|
{
|
||||||
type Message = Message;
|
type Message = Message;
|
||||||
|
|
||||||
// we're never done because we react to external work requests.
|
// we're never done because we react to external work requests.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
use pallas_chainsync::{ClientConsumer, NoopObserver};
|
use pallas_chainsync::{ClientConsumer, NoopObserver};
|
||||||
use pallas_handshake::{MAINNET_MAGIC, n2c::{Client, VersionTable}};
|
use pallas_handshake::{
|
||||||
|
n2c::{Client, VersionTable},
|
||||||
|
MAINNET_MAGIC,
|
||||||
|
};
|
||||||
use pallas_machines::primitives::Point;
|
use pallas_machines::primitives::Point;
|
||||||
use pallas_machines::run_agent;
|
use pallas_machines::run_agent;
|
||||||
use pallas_multiplexer::Multiplexer;
|
use pallas_multiplexer::Multiplexer;
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,20 @@ use pallas_machines::{
|
||||||
use crate::{BlockBody, Message, State, Tip, WrappedHeader};
|
use crate::{BlockBody, Message, State, Tip, WrappedHeader};
|
||||||
|
|
||||||
/// An observer of chain-sync events sent by the state-machine
|
/// An observer of chain-sync events sent by the state-machine
|
||||||
pub trait Observer<C> where C: Debug {
|
pub trait Observer<C>
|
||||||
fn on_block(&self, cursor: &Option<Point>, content: &C) -> Result<(), Box<dyn std::error::Error>> {
|
where
|
||||||
log::debug!("asked to save block content {:?} at cursor {:?}", content, cursor);
|
C: Debug,
|
||||||
|
{
|
||||||
|
fn on_block(
|
||||||
|
&self,
|
||||||
|
cursor: &Option<Point>,
|
||||||
|
content: &C,
|
||||||
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
log::debug!(
|
||||||
|
"asked to save block content {:?} at cursor {:?}",
|
||||||
|
content,
|
||||||
|
cursor
|
||||||
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,7 @@ fn main() {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
|
|
||||||
//let bearer = TcpStream::connect("localhost:6000").unwrap();
|
//let bearer = TcpStream::connect("localhost:6000").unwrap();
|
||||||
let bearer =
|
let bearer = TcpStream::connect("relays-new.cardano-mainnet.iohk.io:3001").unwrap();
|
||||||
TcpStream::connect("relays-new.cardano-mainnet.iohk.io:3001").unwrap();
|
|
||||||
|
|
||||||
bearer.set_nodelay(true).unwrap();
|
bearer.set_nodelay(true).unwrap();
|
||||||
bearer.set_keepalive_ms(Some(30_000u32)).unwrap();
|
bearer.set_keepalive_ms(Some(30_000u32)).unwrap();
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
use core::panic;
|
use core::panic;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use pallas_machines::{Agent, CodecError, DecodePayload, EncodePayload, MachineOutput, PayloadDecoder, PayloadEncoder};
|
use pallas_machines::{
|
||||||
|
Agent, CodecError, DecodePayload, EncodePayload, MachineOutput, PayloadDecoder, PayloadEncoder,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::common::{NetworkMagic, RefuseReason, VersionNumber};
|
use crate::common::{NetworkMagic, RefuseReason, VersionNumber};
|
||||||
|
|
||||||
|
|
@ -39,11 +41,9 @@ impl VersionTable {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn only_v10(network_magic: u64) -> VersionTable {
|
pub fn only_v10(network_magic: u64) -> VersionTable {
|
||||||
let values = vec![
|
let values = vec![(PROTOCOL_V10, VersionData(network_magic))]
|
||||||
(PROTOCOL_V10, VersionData(network_magic)),
|
.into_iter()
|
||||||
]
|
.collect::<HashMap<u64, VersionData>>();
|
||||||
.into_iter()
|
|
||||||
.collect::<HashMap<u64, VersionData>>();
|
|
||||||
|
|
||||||
VersionTable { values }
|
VersionTable { values }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
use core::panic;
|
use core::panic;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use pallas_machines::{Agent, CodecError, DecodePayload, EncodePayload, MachineOutput, PayloadDecoder, PayloadEncoder};
|
use pallas_machines::{
|
||||||
|
Agent, CodecError, DecodePayload, EncodePayload, MachineOutput, PayloadDecoder, PayloadEncoder,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::common::{RefuseReason, VersionNumber};
|
use crate::common::{RefuseReason, VersionNumber};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
use minicbor::data::Cbor;
|
|
||||||
use pallas_localstate::queries::RequestV10;
|
|
||||||
use pallas_localstate::{OneShotClient, queries::QueryV10};
|
|
||||||
use pallas_handshake::n2c::{Client, VersionTable};
|
use pallas_handshake::n2c::{Client, VersionTable};
|
||||||
use pallas_handshake::{MAINNET_MAGIC};
|
use pallas_handshake::MAINNET_MAGIC;
|
||||||
use pallas_machines::{DecodePayload, EncodePayload, run_agent};
|
use pallas_localstate::queries::RequestV10;
|
||||||
|
use pallas_localstate::{queries::QueryV10, OneShotClient};
|
||||||
|
use pallas_machines::run_agent;
|
||||||
use pallas_multiplexer::Multiplexer;
|
use pallas_multiplexer::Multiplexer;
|
||||||
use std::os::unix::net::UnixStream;
|
use std::os::unix::net::UnixStream;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,9 @@ impl DecodePayload for AcquireFailure {
|
||||||
match code {
|
match code {
|
||||||
0 => Ok(AcquireFailure::PointTooOld),
|
0 => Ok(AcquireFailure::PointTooOld),
|
||||||
1 => Ok(AcquireFailure::PointNotInChain),
|
1 => Ok(AcquireFailure::PointNotInChain),
|
||||||
_ => Err(Box::new(CodecError::UnexpectedCbor("can't infer acquire failure from variant id"))),
|
_ => Err(Box::new(CodecError::UnexpectedCbor(
|
||||||
|
"can't infer acquire failure from variant id",
|
||||||
|
))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
pub mod queries;
|
|
||||||
mod codec;
|
mod codec;
|
||||||
|
pub mod queries;
|
||||||
|
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
use log::debug;
|
use log::debug;
|
||||||
|
|
||||||
use pallas_machines::{Agent, DecodePayload, EncodePayload, MachineError, MachineOutput, Transition, primitives::Point};
|
use pallas_machines::{
|
||||||
|
primitives::Point, Agent, DecodePayload, EncodePayload, MachineError, MachineOutput, Transition,
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub enum State {
|
pub enum State {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use minicbor::{Decoder, data::Cbor};
|
use minicbor::{data::Cbor, Decoder};
|
||||||
use pallas_machines::{DecodePayload, EncodePayload, PayloadDecoder, primitives::Point};
|
use pallas_machines::{primitives::Point, DecodePayload, EncodePayload, PayloadDecoder};
|
||||||
|
|
||||||
use super::Query;
|
use super::Query;
|
||||||
|
|
||||||
|
|
@ -20,10 +20,8 @@ impl EncodePayload for RequestV10 {
|
||||||
e: &mut pallas_machines::PayloadEncoder,
|
e: &mut pallas_machines::PayloadEncoder,
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
match self {
|
match self {
|
||||||
Self::BlockQuery(block_query) => {
|
Self::BlockQuery(..) => {
|
||||||
e.u16(0)?;
|
todo!()
|
||||||
e.array(0)?;
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
Self::GetSystemStart => {
|
Self::GetSystemStart => {
|
||||||
e.u16(1)?;
|
e.u16(1)?;
|
||||||
|
|
@ -43,7 +41,7 @@ impl EncodePayload for RequestV10 {
|
||||||
|
|
||||||
impl DecodePayload for RequestV10 {
|
impl DecodePayload for RequestV10 {
|
||||||
fn decode_payload(
|
fn decode_payload(
|
||||||
d: &mut pallas_machines::PayloadDecoder,
|
_d: &mut pallas_machines::PayloadDecoder,
|
||||||
) -> Result<Self, Box<dyn std::error::Error>> {
|
) -> Result<Self, Box<dyn std::error::Error>> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
@ -55,7 +53,7 @@ pub struct GenericResponse(Vec<u8>);
|
||||||
impl EncodePayload for GenericResponse {
|
impl EncodePayload for GenericResponse {
|
||||||
fn encode_payload(
|
fn encode_payload(
|
||||||
&self,
|
&self,
|
||||||
e: &mut pallas_machines::PayloadEncoder,
|
_e: &mut pallas_machines::PayloadEncoder,
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use super::primitives::*;
|
|
||||||
use super::payloads::*;
|
use super::payloads::*;
|
||||||
|
use super::primitives::*;
|
||||||
|
|
||||||
impl EncodePayload for Point {
|
impl EncodePayload for Point {
|
||||||
fn encode_payload(&self, e: &mut PayloadEncoder) -> Result<(), Box<dyn std::error::Error>> {
|
fn encode_payload(&self, e: &mut PayloadEncoder) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
|
mod codec;
|
||||||
mod payloads;
|
mod payloads;
|
||||||
pub mod primitives;
|
pub mod primitives;
|
||||||
mod codec;
|
|
||||||
|
|
||||||
use log::{debug, trace};
|
use log::{debug, trace};
|
||||||
use pallas_multiplexer::{Channel, Payload};
|
use pallas_multiplexer::{Channel, Payload};
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
use std::fmt::{Debug, Display};
|
use std::fmt::{Debug, Display};
|
||||||
use std::sync::mpsc::{Sender};
|
use std::sync::mpsc::Sender;
|
||||||
|
|
||||||
pub use payloads::*;
|
pub use payloads::*;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,11 @@ use super::*;
|
||||||
|
|
||||||
use log::{debug, warn};
|
use log::{debug, warn};
|
||||||
use minicbor::{Decoder, Encoder};
|
use minicbor::{Decoder, Encoder};
|
||||||
use std::{ops::{Deref, DerefMut}, sync::mpsc::Receiver};
|
|
||||||
use pallas_multiplexer::Payload;
|
use pallas_multiplexer::Payload;
|
||||||
|
use std::{
|
||||||
|
ops::{Deref, DerefMut},
|
||||||
|
sync::mpsc::Receiver,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct PayloadEncoder<'a>(Encoder<&'a mut Vec<u8>>);
|
pub struct PayloadEncoder<'a>(Encoder<&'a mut Vec<u8>>);
|
||||||
|
|
||||||
|
|
@ -22,7 +25,10 @@ impl<'a> DerefMut for PayloadEncoder<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> PayloadEncoder<'a> {
|
impl<'a> PayloadEncoder<'a> {
|
||||||
pub fn encode_payload<T: EncodePayload>(&mut self, t: &T)->Result<(), Box<dyn std::error::Error>> {
|
pub fn encode_payload<T: EncodePayload>(
|
||||||
|
&mut self,
|
||||||
|
t: &T,
|
||||||
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
t.encode_payload(self)
|
t.encode_payload(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -95,7 +101,6 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub trait DecodePayload: Sized {
|
pub trait DecodePayload: Sized {
|
||||||
fn decode_payload(d: &mut PayloadDecoder) -> Result<Self, Box<dyn std::error::Error>>;
|
fn decode_payload(d: &mut PayloadDecoder) -> Result<Self, Box<dyn std::error::Error>>;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use std::{net::TcpListener, os::unix::net::UnixListener, thread, time::Duration};
|
use std::{os::unix::net::UnixListener, thread, time::Duration};
|
||||||
|
|
||||||
use pallas_multiplexer::{Channel, Multiplexer};
|
use pallas_multiplexer::{Channel, Multiplexer};
|
||||||
|
|
||||||
|
|
@ -15,7 +15,7 @@ fn main() {
|
||||||
|
|
||||||
for protocol in PROTOCOLS {
|
for protocol in PROTOCOLS {
|
||||||
let handle = muxer.use_channel(protocol);
|
let handle = muxer.use_channel(protocol);
|
||||||
|
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
let Channel(_, rx) = handle;
|
let Channel(_, rx) = handle;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use std::{net::TcpStream, os::unix::net::UnixStream, thread, time::Duration};
|
use std::{os::unix::net::UnixStream, thread, time::Duration};
|
||||||
|
|
||||||
use pallas_multiplexer::{Channel, Multiplexer};
|
use pallas_multiplexer::{Channel, Multiplexer};
|
||||||
|
|
||||||
|
|
@ -20,9 +20,7 @@ fn main() {
|
||||||
loop {
|
loop {
|
||||||
let payload = vec![1; 65545];
|
let payload = vec![1; 65545];
|
||||||
tx.send(payload).unwrap();
|
tx.send(payload).unwrap();
|
||||||
thread::sleep(Duration::from_millis(
|
thread::sleep(Duration::from_millis(50u64 + (protocol as u64 * 10u64)));
|
||||||
50u64 + (protocol as u64 * 10u64),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,12 @@
|
||||||
mod bearers;
|
mod bearers;
|
||||||
|
|
||||||
use std::{collections::HashMap, io::{Read, Write}, sync::mpsc::{self, Receiver, Sender, TryRecvError}, thread::{self, JoinHandle}, time::{Duration, Instant}};
|
use std::{
|
||||||
|
collections::HashMap,
|
||||||
|
io::{Read, Write},
|
||||||
|
sync::mpsc::{self, Receiver, Sender, TryRecvError},
|
||||||
|
thread::{self, JoinHandle},
|
||||||
|
time::{Duration, Instant},
|
||||||
|
};
|
||||||
|
|
||||||
use log::{debug, error, trace, warn};
|
use log::{debug, error, trace, warn};
|
||||||
|
|
||||||
|
|
@ -115,7 +121,10 @@ pub struct Multiplexer {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Multiplexer {
|
impl Multiplexer {
|
||||||
pub fn setup<TBearer>(bearer: TBearer, protocols: &[u16]) -> Result<Multiplexer, Box<dyn std::error::Error>>
|
pub fn setup<TBearer>(
|
||||||
|
bearer: TBearer,
|
||||||
|
protocols: &[u16],
|
||||||
|
) -> Result<Multiplexer, Box<dyn std::error::Error>>
|
||||||
where
|
where
|
||||||
TBearer: Bearer + 'static,
|
TBearer: Bearer + 'static,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
use net2::TcpStreamExt;
|
use net2::TcpStreamExt;
|
||||||
use std::net::TcpStream;
|
use std::net::TcpStream;
|
||||||
|
|
||||||
use pallas_txsubmission::{NaiveProvider};
|
|
||||||
use pallas_handshake::n2c::{Client, VersionTable};
|
use pallas_handshake::n2c::{Client, VersionTable};
|
||||||
use pallas_handshake::MAINNET_MAGIC;
|
use pallas_handshake::MAINNET_MAGIC;
|
||||||
use pallas_machines::run_agent;
|
use pallas_machines::run_agent;
|
||||||
use pallas_multiplexer::Multiplexer;
|
use pallas_multiplexer::Multiplexer;
|
||||||
|
use pallas_txsubmission::NaiveProvider;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
|
|
@ -23,7 +23,6 @@ fn main() {
|
||||||
let last = run_agent(Client::initial(versions), &mut hs_channel).unwrap();
|
let last = run_agent(Client::initial(versions), &mut hs_channel).unwrap();
|
||||||
println!("{:?}", last);
|
println!("{:?}", last);
|
||||||
|
|
||||||
|
|
||||||
let mut ts_channel = muxer.use_channel(4);
|
let mut ts_channel = muxer.use_channel(4);
|
||||||
let ts = NaiveProvider::initial(vec![]);
|
let ts = NaiveProvider::initial(vec![]);
|
||||||
let ts = run_agent(ts, &mut ts_channel).unwrap();
|
let ts = run_agent(ts, &mut ts_channel).unwrap();
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@ use std::fmt::Debug;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
|
|
||||||
use pallas_machines::{Agent, CodecError, DecodePayload, EncodePayload, MachineError, MachineOutput, PayloadDecoder, PayloadEncoder, Transition};
|
use pallas_machines::{
|
||||||
|
Agent, CodecError, DecodePayload, EncodePayload, MachineError, MachineOutput, PayloadDecoder,
|
||||||
|
PayloadEncoder, Transition,
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub enum State {
|
pub enum State {
|
||||||
|
|
@ -238,14 +241,8 @@ impl NaiveProvider {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_txs_request(
|
fn on_txs_request(self, requested_txs: Vec<TxId>) -> Transition<Self> {
|
||||||
self,
|
debug!("new txs request {:?}", requested_txs,);
|
||||||
requested_txs: Vec<TxId>,
|
|
||||||
) -> Transition<Self> {
|
|
||||||
debug!(
|
|
||||||
"new txs request {:?}",
|
|
||||||
requested_txs,
|
|
||||||
);
|
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
state: State::Idle,
|
state: State::Idle,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
|
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use pallas_alonzo as alonzo;
|
pub use pallas_alonzo as alonzo;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use pallas_multiplexer as multiplexer;
|
pub use pallas_multiplexer as multiplexer;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue