@@ -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)]
0 commit comments