File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 14
14
sync_blocks ,
15
15
hex_str_to_bytes ,
16
16
)
17
+ from test_framework .messages import CTransaction , COIN
17
18
18
19
class TxnMallTest (BitcoinTestFramework ):
19
20
def set_test_params (self ):
@@ -76,13 +77,13 @@ def run_test(self):
76
77
77
78
# createrawtransaction randomizes the order of its outputs, so swap them if necessary.
78
79
clone_tx = CTransaction ()
79
- clone_tx .deserialize (io .BytesIO (hex_str_to_bytes (clone_raw )))
80
- if (rawtx1 ["vout" ][0 ]["value" ] == 40 and clone_tx .vout [0 ].nValue != 40 or rawtx1 ["vout" ][0 ]["value" ] != 40 and clone_tx .vout [0 ].nValue == 40 ):
80
+ clone_tx .deserialize (io .BytesIO (bytes . fromhex (clone_raw )))
81
+ if (rawtx1 ["vout" ][0 ]["value" ] == 40 and clone_tx .vout [0 ].nValue != 40 * COIN or rawtx1 ["vout" ][0 ]["value" ] != 40 and clone_tx .vout [0 ].nValue == 40 * COIN ):
81
82
(clone_tx .vout [0 ], clone_tx .vout [1 ]) = (clone_tx .vout [1 ], clone_tx .vout [0 ])
82
83
83
84
# Use a different signature hash type to sign. This creates an equivalent but malleated clone.
84
85
# Don't send the clone anywhere yet
85
- tx1_clone = self .nodes [0 ].signrawtransactionwithwallet (clone_raw , None , "ALL|ANYONECANPAY" )
86
+ tx1_clone = self .nodes [0 ].signrawtransactionwithwallet (clone_tx . serialize (). hex () , None , "ALL|ANYONECANPAY" )
86
87
assert_equal (tx1_clone ["complete" ], True )
87
88
88
89
# Have node0 mine a block, if requested:
You can’t perform that action at this time.
0 commit comments