Skip to content

Commit

Permalink
fix all features
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega committed Aug 27, 2024
1 parent 53d4172 commit 2a24ab0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 35 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 7 additions & 31 deletions src/sources/u5c.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
use futures::StreamExt;
use gasket::framework::*;

use pallas::ledger::traverse::MultiEraBlock;
use pallas::network::miniprotocols::Point;
use serde::Deserialize;
use tonic::transport::Channel;
use tonic::Streaming;
use tracing::{debug, error};

use utxorpc_spec::utxorpc::v1alpha::sync::any_chain_block::Chain;
use utxorpc_spec::utxorpc::v1alpha::sync::chain_sync_service_client::ChainSyncServiceClient;
use utxorpc_spec::utxorpc::v1alpha::sync::follow_tip_response::Action;
use utxorpc_spec::utxorpc::v1alpha::sync::{
use pallas::interop::utxorpc::spec::sync::any_chain_block::Chain;
use pallas::interop::utxorpc::spec::sync::follow_tip_response::Action;
use pallas::interop::utxorpc::spec::sync::sync_service_client::SyncServiceClient;
use pallas::interop::utxorpc::spec::sync::{
BlockRef, DumpHistoryRequest, FollowTipRequest, FollowTipResponse,
};
use pallas::network::miniprotocols::Point;

use crate::framework::*;

Expand All @@ -28,7 +26,7 @@ fn point_to_blockref(point: Point) -> Option<BlockRef> {
}

pub struct Worker {
client: ChainSyncServiceClient<Channel>,
client: SyncServiceClient<Channel>,
stream: Option<Streaming<FollowTipResponse>>,
intersect: Option<BlockRef>,
max_items_per_page: u32,
Expand Down Expand Up @@ -57,17 +55,6 @@ impl Worker {
}
}
}
Chain::Raw(bytes) => {
let block = MultiEraBlock::decode(bytes).or_panic()?;

let evt = ChainEvent::Apply(
Point::Specific(block.slot(), block.hash().to_vec()),
Record::CborBlock(bytes.to_vec()),
);

stage.output.send(evt.into()).await.or_panic()?;
stage.chain_tip.set(block.slot() as i64);
}
}
}
}
Expand All @@ -91,17 +78,6 @@ impl Worker {
}
}
}
Chain::Raw(bytes) => {
let block = MultiEraBlock::decode(bytes).or_panic()?;

let evt = ChainEvent::Undo(
Point::Specific(block.slot(), block.hash().to_vec()),
Record::CborBlock(bytes.to_vec()),
);

stage.output.send(evt.into()).await.or_panic()?;
stage.chain_tip.set(block.slot() as i64);
}
}
}
}
Expand Down Expand Up @@ -183,7 +159,7 @@ impl gasket::framework::Worker<Stage> for Worker {
async fn bootstrap(stage: &Stage) -> Result<Self, WorkerError> {
debug!("connecting");

let client = ChainSyncServiceClient::connect(stage.config.url.clone())
let client = SyncServiceClient::connect(stage.config.url.clone())
.await
.or_panic()?;

Expand Down

0 comments on commit 2a24ab0

Please sign in to comment.