Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ pub enum ChainError {
#[error("invalid proposal params")]
InvalidProposalParams,

#[error("phase-1 script rejected the transaction")]
#[error("phase-1 script rejected the transaction: {0}")]
Phase1ValidationRejected(#[from] pallas::ledger::validate::utils::ValidationError),

#[error("couldn't evaluate phase-2 script: {0}")]
Expand Down
30 changes: 19 additions & 11 deletions src/serve/grpc/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,19 @@ fn outputs_match_asset(
asset_pattern: &u5c::cardano::AssetPattern,
outputs: &[u5c::cardano::TxOutput],
) -> bool {
(asset_pattern.asset_name.is_empty() && asset_pattern.policy_id.is_empty())
|| outputs.iter().any(|o| {
o.assets.iter().any(|ma| {
ma.policy_id.eq(&asset_pattern.policy_id)
&& ma
.assets
.iter()
.any(|a| a.name.eq(&asset_pattern.asset_name))
})
outputs.iter().any(|o| {
o.assets.iter().any(|ma| {
if !asset_pattern.policy_id.is_empty() && asset_pattern.policy_id.ne(&ma.policy_id) {
return false;
}
if asset_pattern.asset_name.is_empty() {
return true;
}
ma.assets
.iter()
.any(|ma| asset_pattern.asset_name.eq(&ma.name))
})
})
}

fn matches_output(
Expand Down Expand Up @@ -151,6 +154,7 @@ fn block_to_txs<C: LedgerContext>(
mapper: &interop::Mapper<C>,
request: &u5c::watch::WatchTxRequest,
) -> Vec<u5c::watch::AnyChainTx> {
let bytes = block;
let block = MultiEraBlock::decode(block).unwrap();
let txs = block.txs();

Expand All @@ -164,8 +168,12 @@ fn block_to_txs<C: LedgerContext>(
})
.map(|x| u5c::watch::AnyChainTx {
chain: Some(u5c::watch::any_chain_tx::Chain::Cardano(x)),
// TODO(p): should it be none?
block: None,
block: Some(u5c::watch::AnyChainBlock {
native_bytes: bytes.to_vec().into(),
chain: Some(u5c::watch::any_chain_block::Chain::Cardano(
mapper.map_block(&block),
)),
}),
})
.collect()
}
Expand Down
2 changes: 1 addition & 1 deletion tests/cardano/harness/compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub fn compare_csvs_with_ignore(
let mut ignored = 0usize;

for record in diff_results.as_slice() {
if ignore(&record) {
if ignore(record) {
ignored += 1;
if count < max_rows || max_rows == 0 {
let prefix = match &record {
Expand Down
Loading