Skip to content

Commit

Permalink
fix: add missing collateral in pre-babbage mapper (#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega authored Feb 4, 2024
1 parent 9c688b9 commit fe51bef
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/mapper/babbage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ impl EventWriter {
}

if let Some(collateral) = &tx.collateral {
for (_idx, collateral) in collateral.iter().enumerate() {
for collateral in collateral.iter() {
// TODO: collateral context?

self.crawl_collateral(collateral)?;
Expand Down
9 changes: 9 additions & 0 deletions src/mapper/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,11 @@ impl EventWriter {
}
}

// Add Collateral Stuff
let collateral_inputs = &body.collateral.as_deref();
record.collateral_input_count = collateral_inputs.iter().count();
record.has_collateral_output = false;

// TODO
// TransactionBodyComponent::ScriptDataHash(_)
// TransactionBodyComponent::RequiredSigners(_)
Expand All @@ -434,6 +439,10 @@ impl EventWriter {
record.outputs = outputs.into();
record.inputs = inputs.into();

// transaction_details collateral stuff
record.collateral_inputs =
collateral_inputs.map(|inputs| self.collect_input_records(inputs));

record.metadata = match aux_data {
Some(aux_data) => self.collect_metadata_records(aux_data)?.into(),
None => None,
Expand Down
2 changes: 1 addition & 1 deletion src/mapper/shelley.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ impl EventWriter {
}

if let Some(collateral) = &tx.collateral {
for (_idx, collateral) in collateral.iter().enumerate() {
for collateral in collateral.iter() {
// TODO: collateral context?

self.crawl_collateral(collateral)?;
Expand Down
2 changes: 0 additions & 2 deletions src/sinks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ pub mod assert;
pub mod stdout;
pub mod terminal;

pub use common::*;

#[cfg(feature = "logs")]
pub mod logs;

Expand Down

0 comments on commit fe51bef

Please sign in to comment.