diff --git a/examples/create_max_dust.rs b/examples/create_max_dust.rs index e1710a1f4..884a79350 100644 --- a/examples/create_max_dust.rs +++ b/examples/create_max_dust.rs @@ -66,22 +66,17 @@ async fn main() -> Result<()> { // We use the outputs directly so we don't double spend them let mut initial_outputs = Vec::new(); if let Some(Payload::Transaction(tx)) = message.payload() { - match tx.essence() { - Essence::Regular(essence) => { - for (index, output) in essence.outputs().iter().enumerate() { - // Only include 1 Mi outputs, otherwise it fails for the remainder address - if let Output::SignatureLockedSingle(output) = output { - if output.amount() == 1_000_001 { - initial_outputs.push(UtxoInput::new(tx.id(), index as u16)?); - } - } + let Essence::Regular(essence) = tx.essence(); + for (index, output) in essence.outputs().iter().enumerate() { + // Only include 1 Mi outputs, otherwise it fails for the remainder address + if let Output::SignatureLockedSingle(output) = output { + if output.amount() == 1_000_001 { + initial_outputs.push(UtxoInput::new(tx.id(), index as u16)?); } } - _ => { - panic!("Non-existing essence type"); - } } } + let first_address_old_seed = iota.get_addresses(&seed).with_range(0..1).finish().await?; let mut sent_messages = Vec::new(); for (index, output) in initial_outputs.into_iter().enumerate() { diff --git a/examples/split_outputs_single_address.rs b/examples/split_outputs_single_address.rs index eb8658e6d..9c5637afd 100644 --- a/examples/split_outputs_single_address.rs +++ b/examples/split_outputs_single_address.rs @@ -55,22 +55,17 @@ async fn main() -> Result<()> { // We use the outputs directly so we don't double spend them let mut initial_outputs = Vec::new(); if let Some(Payload::Transaction(tx)) = message.payload() { - match tx.essence() { - Essence::Regular(essence) => { - for (index, output) in essence.outputs().iter().enumerate() { - // Only include 1 Mi outputs, otherwise it fails for the remainder address - if let Output::SignatureLockedSingle(output) = output { - if output.amount() == 1_000_000 { - initial_outputs.push(UtxoInput::new(tx.id(), index as u16).unwrap()); - } - } + let Essence::Regular(essence) = tx.essence(); + for (index, output) in essence.outputs().iter().enumerate() { + // Only include 1 Mi outputs, otherwise it fails for the remainder address + if let Output::SignatureLockedSingle(output) = output { + if output.amount() == 1_000_000 { + initial_outputs.push(UtxoInput::new(tx.id(), index as u16).unwrap()); } } - _ => { - panic!("Non-existing essence type"); - } } } + let mut sent_messages = Vec::new(); for (index, output) in initial_outputs.into_iter().enumerate() { let message_id = iota diff --git a/examples/txspam.rs b/examples/txspam.rs index 6f4155e57..462ef35da 100644 --- a/examples/txspam.rs +++ b/examples/txspam.rs @@ -52,15 +52,9 @@ async fn main() -> Result<()> { // Use own outputs directly so we don't double spend them let mut initial_outputs = Vec::new(); if let Some(Payload::Transaction(tx)) = message.payload() { - match tx.essence() { - Essence::Regular(essence) => { - for (index, _output) in essence.outputs().iter().enumerate() { - initial_outputs.push(UtxoInput::new(tx.id(), index as u16)?); - } - } - _ => { - panic!("Non-existing essence type"); - } + let Essence::Regular(essence) = tx.essence(); + for (index, _output) in essence.outputs().iter().enumerate() { + initial_outputs.push(UtxoInput::new(tx.id(), index as u16)?); } }