diff --git a/src/bin/dolos/eval.rs b/src/bin/dolos/eval.rs index 19d6ad20..64ebbb9d 100644 --- a/src/bin/dolos/eval.rs +++ b/src/bin/dolos/eval.rs @@ -46,7 +46,7 @@ pub fn run(config: &super::Config, args: &Args) -> miette::Result<()> { for (ref_, output) in utxos.iter() { let txin = pallas::ledger::primitives::byron::TxIn::Variant0( - pallas::codec::utils::CborWrap((ref_.0.clone(), ref_.1 as u32)), + pallas::codec::utils::CborWrap((ref_.0, ref_.1 as u32)), ); let key = MultiEraInput::Byron( diff --git a/src/storage/applydb/mod.rs b/src/storage/applydb/mod.rs index d5aa0b37..5820b653 100644 --- a/src/storage/applydb/mod.rs +++ b/src/storage/applydb/mod.rs @@ -313,12 +313,11 @@ impl ApplyDB { let utxo_ref = UtxoRef(hash, idx); - if !utxos.contains_key(&utxo_ref) { + if let std::collections::hash_map::Entry::Vacant(e) = utxos.entry(utxo_ref) { let utxo = self .get_utxo(hash, idx)? .ok_or(Error::MissingUtxo(hash, idx))?; - - utxos.insert(utxo_ref, utxo); + e.insert(utxo); }; } @@ -434,7 +433,8 @@ impl ApplyDB { prot_magic: self.prot_magic, network_id: self.network_id, }) - } else if block_slot >= 4492800 && block_slot < 40348902 { + } else if (4492800..39916974).contains(&block_slot) { + // The ShelleyMA era spans from block slot 4492800 to 39916974 Ok(Environment { prot_params: MultiEraProtParams::Byron(ByronProtParams { fee_policy: FeePolicy { diff --git a/src/sync/ledger.rs b/src/sync/ledger.rs index 4fc5ffa2..e04fb0a5 100644 --- a/src/sync/ledger.rs +++ b/src/sync/ledger.rs @@ -16,14 +16,14 @@ pub fn execute_phase1_validation( ) -> Result<(), WorkerError> { let mut utxos = HashMap::new(); ledger - .resolve_inputs_for_block(&block, &mut utxos) + .resolve_inputs_for_block(block, &mut utxos) .or_panic()?; let mut utxos2 = UTxOs::new(); for (ref_, output) in utxos.iter() { let txin = pallas::ledger::primitives::byron::TxIn::Variant0( - pallas::codec::utils::CborWrap((ref_.0.clone(), ref_.1 as u32)), + pallas::codec::utils::CborWrap((ref_.0, ref_.1 as u32)), ); let key = MultiEraInput::Byron( @@ -39,7 +39,7 @@ pub fn execute_phase1_validation( let env = ledger.get_active_pparams(block.slot()).or_panic()?; for tx in block.txs().iter() { - let res = validate(&tx, &utxos2, &env); + let res = validate(tx, &utxos2, &env); if let Err(err) = res { warn!(?err, "validation error");