Don't match on complex expression
Passing a complex expression to `match` is hard to read. Assign it to a variable first.
This commit is contained in:
parent
6cdbb04820
commit
5fd731f095
|
@ -1929,7 +1929,8 @@ mod tests {
|
||||||
let mut witness: Vec<_> = spending.input[1].witness.to_vec();
|
let mut witness: Vec<_> = spending.input[1].witness.to_vec();
|
||||||
witness[0][10] = 42;
|
witness[0][10] = 42;
|
||||||
spending.input[1].witness = Witness::from_slice(&witness);
|
spending.input[1].witness = Witness::from_slice(&witness);
|
||||||
match spending
|
|
||||||
|
let error = spending
|
||||||
.verify(|point: &OutPoint| {
|
.verify(|point: &OutPoint| {
|
||||||
if let Some(tx) = spent3.remove(&point.txid) {
|
if let Some(tx) = spent3.remove(&point.txid) {
|
||||||
return tx.output.get(point.vout as usize).cloned();
|
return tx.output.get(point.vout as usize).cloned();
|
||||||
|
@ -1937,8 +1938,9 @@ mod tests {
|
||||||
None
|
None
|
||||||
})
|
})
|
||||||
.err()
|
.err()
|
||||||
.unwrap()
|
.unwrap();
|
||||||
{
|
|
||||||
|
match error {
|
||||||
TxVerifyError::ScriptVerification(_) => {}
|
TxVerifyError::ScriptVerification(_) => {}
|
||||||
_ => panic!("Wrong error type"),
|
_ => panic!("Wrong error type"),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue