Skip to content

Commit 4bab769

Browse files
committed
rustfmt: change to new notation
1 parent de4e2ec commit 4bab769

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

examples/sign_multisig.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fn main() {
4646
}],
4747
};
4848

49-
#[cfg_attr(feature="cargo-fmt", rustfmt_skip)]
49+
#[rustfmt::skip]
5050
let public_keys = vec![
5151
bitcoin::PublicKey::from_slice(&[2; 33]).expect("key 1"),
5252
bitcoin::PublicKey::from_slice(&[

src/descriptor/csfs_cov/script_internals.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ impl CovOperations for script::Builder {
6767
.push_opcode(all::OP_ENDIF)
6868
}
6969

70+
#[rustfmt::skip]
7071
fn verify_cov(self, key: &bitcoin::PublicKey) -> Self {
72+
use elements::opcodes::all::{OP_CAT, OP_SWAP};
73+
7174
let mut builder = self;
7275
// The miniscript is of type B, which should have pushed 1
7376
// onto the stack if it satisfied correctly.(which it should)
@@ -100,25 +103,22 @@ impl CovOperations for script::Builder {
100103
builder = builder.push_opcode(all::OP_TOALTSTACK);
101104
// alt_stk = [bitcoinsig]
102105
// stk = [ecsig i10 i9 i8 i7 i6 i5 i4 i3b i3 i2 i1]
103-
// Ignore fmt skip because it butchers these lines
104-
#[cfg_attr(feature="cargo-fmt", rustfmt_skip)]
105-
{
106-
// Do the size checks on all respective items in sighash calculation
107-
use elements::opcodes::all::{OP_CAT, OP_SWAP};
108-
builder = builder.chk_size(4).push_opcode(OP_SWAP); // item 1: ver
109-
builder = builder.chk_size(32).push_opcode(OP_CAT).push_opcode(OP_SWAP);//item 2: hashprevouts
110-
builder = builder.chk_size(32).push_opcode(OP_CAT).push_opcode(OP_SWAP);//item 3: hashsequence
111-
builder = builder.chk_size(32).push_opcode(OP_CAT).push_opcode(OP_SWAP);//item 3b: hashissuances
112-
builder = builder.chk_size(36).push_opcode(OP_CAT).push_opcode(OP_SWAP);//item 4: outpoint
113-
// Item 5: Script code is of constant size because we only consider everything after
114-
// codeseparator. This will be replaced with a push slice in a later commit
115-
builder = builder.chk_size(3).push_opcode(OP_CAT).push_opcode(OP_SWAP);//item 5: script code
116-
builder = builder.chk_amt().push_opcode(OP_CAT).push_opcode(OP_SWAP); //item 6: check confAmt
117-
builder = builder.chk_size(4).push_opcode(OP_CAT).push_opcode(OP_SWAP); //item 7: sequence
118-
builder = builder.chk_size(32).push_opcode(OP_CAT).push_opcode(OP_SWAP);//item 8: hashoutputs
119-
builder = builder.chk_size(4).push_opcode(OP_CAT).push_opcode(OP_SWAP); //item 9: nlocktime
120-
builder = builder.chk_size(4).push_opcode(OP_CAT); //item 10: sighash type
121-
}
106+
107+
// Do the size checks on all respective items in sighash calculation
108+
builder = builder.chk_size(4).push_opcode(OP_SWAP); // item 1: ver
109+
builder = builder.chk_size(32).push_opcode(OP_CAT).push_opcode(OP_SWAP);//item 2: hashprevouts
110+
builder = builder.chk_size(32).push_opcode(OP_CAT).push_opcode(OP_SWAP);//item 3: hashsequence
111+
builder = builder.chk_size(32).push_opcode(OP_CAT).push_opcode(OP_SWAP);//item 3b: hashissuances
112+
builder = builder.chk_size(36).push_opcode(OP_CAT).push_opcode(OP_SWAP);//item 4: outpoint
113+
// Item 5: Script code is of constant size because we only consider everything after
114+
// codeseparator. This will be replaced with a push slice in a later commit
115+
builder = builder.chk_size(3).push_opcode(OP_CAT).push_opcode(OP_SWAP); //item 5: script code
116+
builder = builder.chk_amt().push_opcode(OP_CAT).push_opcode(OP_SWAP); //item 6: check confAmt
117+
builder = builder.chk_size(4).push_opcode(OP_CAT).push_opcode(OP_SWAP); //item 7: sequence
118+
builder = builder.chk_size(32).push_opcode(OP_CAT).push_opcode(OP_SWAP);//item 8: hashoutputs
119+
builder = builder.chk_size(4).push_opcode(OP_CAT).push_opcode(OP_SWAP); //item 9: nlocktime
120+
builder = builder.chk_size(4).push_opcode(OP_CAT); //item 10: sighash type
121+
122122
// Now sighash is on the top of the stack
123123
// alt_stk = [bitcoinsig]
124124
// stk = [ecsig (i1||i2||i3||i3b||i4||i5||i6||i7||i8||i9||i10)]

src/miniscript/ms_tests.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ mod tests {
6868
}
6969

7070
#[test]
71-
#[cfg_attr(feature="cargo-fmt", rustfmt_skip)]
71+
#[rustfmt::skip]
7272
fn invalid_tests_from_alloy() {
7373
invalid_ms("or_b(or_i(0,sha256(926a54995ca48600920a19bf7bc502ca5f2f7d07e6f804c4f00ebf0325084dbc)),after(1))");
7474
invalid_ms("or_b(s:pk_h(A),after(500000001))");
@@ -5646,7 +5646,7 @@ mod tests {
56465646
invalid_ms("c:or_b(sha256(926a54995ca48600920a19bf7bc502ca5f2f7d07e6f804c4f00ebf0325084dbc),pk_k(A))");
56475647
}
56485648
#[test]
5649-
#[cfg_attr(feature="cargo-fmt", rustfmt_skip)]
5649+
#[rustfmt::skip]
56505650
fn mall_8f1e8_tests_from_alloy() {
56515651
ms_test("or_d(or_d(sha256(926a54995ca48600920a19bf7bc502ca5f2f7d07e6f804c4f00ebf0325084dbc),sha256(926a54995ca48600920a19bf7bc502ca5f2f7d07e6f804c4f00ebf0325084dbc)),after(500000001))", "Bf");
56525652
ms_test("andor(sha256(926a54995ca48600920a19bf7bc502ca5f2f7d07e6f804c4f00ebf0325084dbc),or_d(multi(2,A,B,C),sha256(926a54995ca48600920a19bf7bc502ca5f2f7d07e6f804c4f00ebf0325084dbc)),after(1))", "B");
@@ -9143,7 +9143,7 @@ mod tests {
91439143

91449144
}
91459145
#[test]
9146-
#[cfg_attr(feature="cargo-fmt", rustfmt_skip)]
9146+
#[rustfmt::skip]
91479147
fn main_tests_from_alloy() {
91489148
ms_test("or_d(or_d(multi(2,A,B,C),or_d(multi(2,D,E,F),multi(2,G,I,J))),multi(2,K,L,M))", "Bdusem");
91499149
ms_test("andor(multi(2,A,B,C),or_d(multi(2,D,E,F),sha256(926a54995ca48600920a19bf7bc502ca5f2f7d07e6f804c4f00ebf0325084dbc)),c:pk_h(G))", "Bdusem");
@@ -15044,7 +15044,7 @@ mod tests {
1504415044
}
1504515045

1504615046
#[test]
15047-
#[cfg_attr(feature="cargo-fmt", rustfmt_skip)]
15047+
#[rustfmt::skip]
1504815048
fn malleable_tests_from_alloy() {
1504915049
ms_test("and_v(v:after(500000001),or_d(j:multi(2,A,B,C),multi(2,D,E,F)))", "usB");
1505015050
ms_test("or_b(j:multi(2,A,B,C),a:andor(multi(2,D,E,F),multi(2,G,I,J),multi(2,K,L,M)))", "dBesu");
@@ -22076,8 +22076,8 @@ mod tests {
2207622076
// This does not actually test timelock mixing. See: https://github.com/rust-bitcoin/rust-miniscript/issues/514
2207722077
// for details
2207822078
#[test]
22079+
#[rustfmt::skip]
2207922080
fn conflict_tests_from_alloy() {
22080-
#[cfg_attr(feature="cargo-fmt", rustfmt_skip)]
2208122081
{
2208222082
ms_test("andor(multi(2,A,B,C),andor(multi(2,D,E,F),after(500000001),n:after(1)),0)","Bedsm");
2208322083
ms_test("and_v(v:after(500000001),or_d(multi(2,A,B,C),and_b(multi(2,D,E,F),a:after(1))))","Busm");

0 commit comments

Comments
 (0)