@@ -86,65 +86,65 @@ def run_test(self):
86
86
tmpl ['coinbasetxn' ] = {'data' : '01000000' + '01' + '0000000000000000000000000000000000000000000000000000000000000000ffffffff' + ('%02x' % (len (rawcoinbase ),)) + hexcoinbase + 'fffffffe' + '01' + hexoutval + '00' + '00000000' }
87
87
txlist = list (bytearray (a2b_hex (a ['data' ])) for a in (tmpl ['coinbasetxn' ],) + tuple (tmpl ['transactions' ]))
88
88
89
- # Test 0: Capability advertised
89
+ self . log . info ( "getblocktemplate: Test capability advertised" )
90
90
assert ('proposal' in tmpl ['capabilities' ])
91
91
92
- # Test 2: Bad input hash for gen tx
92
+ self . log . info ( "getblocktemplate: Test bad input hash for coinbase transaction" )
93
93
txlist [0 ][4 + 1 ] += 1
94
94
assert_template (node , tmpl , txlist , 'bad-cb-missing' )
95
95
txlist [0 ][4 + 1 ] -= 1
96
96
97
- # Test 3: Truncated final tx
97
+ self . log . info ( "getblocktemplate: Test truncated final transaction" )
98
98
lastbyte = txlist [- 1 ].pop ()
99
99
assert_raises_jsonrpc (- 22 , "Block decode failed" , assert_template , node , tmpl , txlist , 'n/a' )
100
100
txlist [- 1 ].append (lastbyte )
101
101
102
- # Test 4: Add an invalid tx to the end ( duplicate of gen tx )
102
+ self . log . info ( "getblocktemplate: Test duplicate transaction" )
103
103
txlist .append (txlist [0 ])
104
104
assert_template (node , tmpl , txlist , 'bad-txns-duplicate' )
105
105
txlist .pop ()
106
106
107
- # Test 5: Add an invalid tx to the end (non-duplicate )
107
+ self . log . info ( "getblocktemplate: Test invalid transaction" )
108
108
txlist .append (bytearray (txlist [0 ]))
109
109
txlist [- 1 ][4 + 1 ] = 0xff
110
110
assert_template (node , tmpl , txlist , 'bad-txns-inputs-missingorspent' )
111
111
txlist .pop ()
112
112
113
- # Test 6: Future tx lock time
113
+ self . log . info ( "getblocktemplate: Test nonfinal transaction" )
114
114
txlist [0 ][- 4 :] = b'\xff \xff \xff \xff '
115
115
assert_template (node , tmpl , txlist , 'bad-txns-nonfinal' )
116
116
txlist [0 ][- 4 :] = b'\0 \0 \0 \0 '
117
117
118
- # Test 7: Bad tx count
118
+ self . log . info ( "getblocktemplate: Test bad tx count" )
119
119
txlist .append (b'' )
120
120
assert_raises_jsonrpc (- 22 , 'Block decode failed' , assert_template , node , tmpl , txlist , 'n/a' )
121
121
txlist .pop ()
122
122
123
- # Test 8: Bad bits
123
+ self . log . info ( "getblocktemplate: Test bad bits" )
124
124
realbits = tmpl ['bits' ]
125
125
tmpl ['bits' ] = '1c0000ff' # impossible in the real world
126
126
assert_template (node , tmpl , txlist , 'bad-diffbits' )
127
127
tmpl ['bits' ] = realbits
128
128
129
- # Test 9: Bad merkle root
129
+ self . log . info ( "getblocktemplate: Test bad merkle root" )
130
130
rawtmpl = template_to_bytearray (tmpl , txlist )
131
131
rawtmpl [4 + 32 ] = (rawtmpl [4 + 32 ] + 1 ) % 0x100
132
132
rsp = node .getblocktemplate ({'data' : b2x (rawtmpl ), 'mode' : 'proposal' })
133
133
if rsp != 'bad-txnmrklroot' :
134
134
raise AssertionError ('unexpected: %s' % (rsp ,))
135
135
136
- # Test 10: Bad timestamps
136
+ self . log . info ( "getblocktemplate: Test bad timestamps" )
137
137
realtime = tmpl ['curtime' ]
138
138
tmpl ['curtime' ] = 0x7fffffff
139
139
assert_template (node , tmpl , txlist , 'time-too-new' )
140
140
tmpl ['curtime' ] = 0
141
141
assert_template (node , tmpl , txlist , 'time-too-old' )
142
142
tmpl ['curtime' ] = realtime
143
143
144
- # Test 11: Valid block
144
+ self . log . info ( "getblocktemplate: Test valid block" )
145
145
assert_template (node , tmpl , txlist , None )
146
146
147
- # Test 12: Orphan block
147
+ self . log . info ( "getblocktemplate: Test not best block" )
148
148
tmpl ['previousblockhash' ] = 'ff00' * 16
149
149
assert_template (node , tmpl , txlist , 'inconclusive-not-best-prevblk' )
150
150
0 commit comments