Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
gmart7t2 committed Aug 20, 2023
1 parent 880f137 commit 6d8dd9d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 13 deletions.
36 changes: 23 additions & 13 deletions src/subcommand/wallet/inscribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ impl Inscribe {
for i in &tx.input {
sum_in += utxos
.get(&i.previous_output)
.expect(format!("can't find utxo {}", i.previous_output).as_str())
.unwrap_or_else(|| panic!("can't find utxo {}", i.previous_output))
.to_sat();
tprintln!(
" value {} {}",
Expand Down Expand Up @@ -718,13 +718,11 @@ impl Inscribe {
if !allow_reinscribe {
return Err(anyhow!("sat at {} already inscribed", satpoint));
}
} else if inscribed_satpoint.outpoint == satpoint.outpoint {
if !ignore_utxo_inscriptions {
return Err(anyhow!(
"utxo {} already inscribed with inscription {inscription_id} on sat {inscribed_satpoint}",
satpoint.outpoint,
));
}
} else if inscribed_satpoint.outpoint == satpoint.outpoint && !ignore_utxo_inscriptions {
return Err(anyhow!(
"utxo {} already inscribed with inscription {inscription_id} on sat {inscribed_satpoint}",
satpoint.outpoint,
));
}
}

Expand Down Expand Up @@ -930,11 +928,7 @@ impl Inscribe {
.witness_mut(reveal_vout_postage)
.expect("getting mutable witness reference should work");

if allow_reveal_rbf {
let mut signature = signature.as_ref().to_vec();
signature.push(hash_ty as u8);
witness.push(signature);
} else if cursed_outpoint.is_some() {
if allow_reveal_rbf || cursed_outpoint.is_some() {
let mut signature = signature.as_ref().to_vec();
signature.push(hash_ty as u8);
witness.push(signature);
Expand Down Expand Up @@ -1095,6 +1089,8 @@ mod tests {
false,
false,
false,
false,
false,
)
.unwrap();

Expand Down Expand Up @@ -1135,6 +1131,8 @@ mod tests {
false,
false,
false,
false,
false,
)
.unwrap();

Expand Down Expand Up @@ -1179,6 +1177,8 @@ mod tests {
false,
false,
false,
false,
false,
)
.unwrap_err()
.to_string();
Expand Down Expand Up @@ -1230,6 +1230,8 @@ mod tests {
false,
false,
false,
false,
false,
)
.is_ok())
}
Expand Down Expand Up @@ -1276,6 +1278,8 @@ mod tests {
false,
false,
false,
false,
false,
)
.unwrap();

Expand Down Expand Up @@ -1350,6 +1354,8 @@ mod tests {
false,
false,
false,
false,
false,
)
.unwrap();

Expand Down Expand Up @@ -1408,6 +1414,8 @@ mod tests {
false,
false,
false,
false,
false,
)
.unwrap_err()
.to_string();
Expand Down Expand Up @@ -1449,6 +1457,8 @@ mod tests {
false,
false,
false,
false,
false,
)
.unwrap();

Expand Down
18 changes: 18 additions & 0 deletions src/subcommand/wallet/transaction_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,7 @@ mod tests {
vec![Target::Postage],
TransactionBuilder::DEFAULT_TARGET_POSTAGE,
TransactionBuilder::DEFAULT_MAX_POSTAGE,
false,
)
.unwrap()
.select_outgoing()
Expand Down Expand Up @@ -1001,6 +1002,7 @@ mod tests {
max_postage: TransactionBuilder::DEFAULT_MAX_POSTAGE,
current_output: 0,
padding_outputs: 0,
ignore_utxo_inscriptions: false,
};

pretty_assert_eq!(
Expand Down Expand Up @@ -1081,6 +1083,7 @@ mod tests {
vec![Target::Postage],
TransactionBuilder::DEFAULT_TARGET_POSTAGE,
TransactionBuilder::DEFAULT_MAX_POSTAGE,
false,
)
.unwrap()
.select_outgoing()
Expand Down Expand Up @@ -1217,6 +1220,7 @@ mod tests {
vec![Target::Postage],
TransactionBuilder::DEFAULT_TARGET_POSTAGE,
TransactionBuilder::DEFAULT_MAX_POSTAGE,
false,
)
.unwrap()
.build()
Expand All @@ -1240,6 +1244,7 @@ mod tests {
vec![Target::Postage],
TransactionBuilder::DEFAULT_TARGET_POSTAGE,
TransactionBuilder::DEFAULT_MAX_POSTAGE,
false,
)
.unwrap()
.build()
Expand All @@ -1263,6 +1268,7 @@ mod tests {
vec![Target::Postage],
TransactionBuilder::DEFAULT_TARGET_POSTAGE,
TransactionBuilder::DEFAULT_MAX_POSTAGE,
false,
)
.unwrap()
.build()
Expand All @@ -1286,6 +1292,7 @@ mod tests {
vec![Target::Postage],
TransactionBuilder::DEFAULT_TARGET_POSTAGE,
TransactionBuilder::DEFAULT_MAX_POSTAGE,
false,
)
.unwrap()
.select_outgoing()
Expand Down Expand Up @@ -1316,6 +1323,7 @@ mod tests {
vec![Target::Postage],
TransactionBuilder::DEFAULT_TARGET_POSTAGE,
TransactionBuilder::DEFAULT_MAX_POSTAGE,
false,
)
.unwrap()
.select_outgoing()
Expand Down Expand Up @@ -1375,6 +1383,7 @@ mod tests {
vec![Target::Postage],
TransactionBuilder::DEFAULT_TARGET_POSTAGE,
TransactionBuilder::DEFAULT_MAX_POSTAGE,
false,
)
.unwrap()
.select_outgoing()
Expand Down Expand Up @@ -1455,6 +1464,7 @@ mod tests {
vec![Target::Postage],
TransactionBuilder::DEFAULT_TARGET_POSTAGE,
TransactionBuilder::DEFAULT_MAX_POSTAGE,
false,
)
.unwrap()
.select_outgoing()
Expand Down Expand Up @@ -1487,6 +1497,7 @@ mod tests {
vec![Target::Postage],
TransactionBuilder::DEFAULT_TARGET_POSTAGE,
TransactionBuilder::DEFAULT_MAX_POSTAGE,
false,
)
.unwrap()
.select_outgoing()
Expand Down Expand Up @@ -1517,6 +1528,7 @@ mod tests {
vec![Target::Postage],
TransactionBuilder::DEFAULT_TARGET_POSTAGE,
TransactionBuilder::DEFAULT_MAX_POSTAGE,
false,
)
.unwrap()
.select_outgoing()
Expand Down Expand Up @@ -1544,6 +1556,7 @@ mod tests {
vec![Target::Postage],
TransactionBuilder::DEFAULT_TARGET_POSTAGE,
TransactionBuilder::DEFAULT_MAX_POSTAGE,
false,
)
.unwrap()
.select_outgoing()
Expand Down Expand Up @@ -1583,6 +1596,7 @@ mod tests {
max_postage: TransactionBuilder::DEFAULT_MAX_POSTAGE,
current_output: 0,
padding_outputs: 0,
ignore_utxo_inscriptions: false,
}
.build()
.unwrap();
Expand Down Expand Up @@ -1618,6 +1632,7 @@ mod tests {
max_postage: TransactionBuilder::DEFAULT_MAX_POSTAGE,
current_output: 0,
padding_outputs: 0,
ignore_utxo_inscriptions: false,
}
.build()
.unwrap();
Expand Down Expand Up @@ -2061,6 +2076,7 @@ mod tests {
vec![Target::Value(Amount::from_sat(10_000))],
Amount::from_sat(0),
Amount::from_sat(0),
false,
)
.unwrap()
.select_outgoing()
Expand Down Expand Up @@ -2110,6 +2126,7 @@ mod tests {
vec![Target::Value(Amount::from_sat(10_000))],
Amount::from_sat(0),
Amount::from_sat(0),
false,
)
.unwrap()
.select_outgoing()
Expand Down Expand Up @@ -2166,6 +2183,7 @@ mod tests {
vec![Target::Value(Amount::from_sat(10_000))],
Amount::from_sat(0),
Amount::from_sat(0),
false,
)
.unwrap();

Expand Down

0 comments on commit 6d8dd9d

Please sign in to comment.