Skip to content

Commit

Permalink
fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega committed Jul 14, 2024
1 parent acc120c commit 52b66c4
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions pallas-utxorpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@ pub trait LedgerContext: Clone {
fn get_utxos(&self, refs: &[TxoRef]) -> Option<UtxoMap>;
}

#[derive(Clone)]
struct NoLedger;

impl LedgerContext for NoLedger {
fn get_utxos(&self, refs: &[TxoRef]) -> Option<UtxoMap> {
None
}
}

#[derive(Default, Clone)]
pub struct Mapper<C: LedgerContext> {
ledger: Option<C>,
Expand All @@ -44,8 +35,6 @@ impl<C: LedgerContext> Mapper<C> {
}
}

type IsolatedMapper = Mapper<NoLedger>;

impl<C: LedgerContext> Mapper<C> {
pub fn map_purpose(&self, x: &conway::RedeemerTag) -> u5c::RedeemerPurpose {
match x {
Expand Down Expand Up @@ -626,12 +615,23 @@ impl<C: LedgerContext> Mapper<C> {

#[cfg(test)]
mod tests {
use super::*;

#[derive(Clone)]
struct NoLedger;

impl LedgerContext for NoLedger {
fn get_utxos(&self, _refs: &[TxoRef]) -> Option<UtxoMap> {
None
}
}

#[test]
fn snapshot() {
let test_blocks = [include_str!("../../test_data/u5c1.block")];
let test_snapshots = [include_str!("../../test_data/u5c1.json")];

let mapper = super::IsolatedMapper::new(crate::NoLedger);
let mapper = Mapper::new(NoLedger);

for (block_str, json_str) in test_blocks.iter().zip(test_snapshots) {
let cbor = hex::decode(block_str).unwrap();
Expand Down

0 comments on commit 52b66c4

Please sign in to comment.