Skip to content

Commit 38b38cd

Browse files
committed
[tests] getblocktemplate_proposals.py: add logging
1 parent 0a3a5ff commit 38b38cd

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

test/functional/getblocktemplate_proposals.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,65 +86,65 @@ def run_test(self):
8686
tmpl['coinbasetxn'] = {'data': '01000000' + '01' + '0000000000000000000000000000000000000000000000000000000000000000ffffffff' + ('%02x' % (len(rawcoinbase),)) + hexcoinbase + 'fffffffe' + '01' + hexoutval + '00' + '00000000'}
8787
txlist = list(bytearray(a2b_hex(a['data'])) for a in (tmpl['coinbasetxn'],) + tuple(tmpl['transactions']))
8888

89-
# Test 0: Capability advertised
89+
self.log.info("getblocktemplate: Test capability advertised")
9090
assert('proposal' in tmpl['capabilities'])
9191

92-
# Test 2: Bad input hash for gen tx
92+
self.log.info("getblocktemplate: Test bad input hash for coinbase transaction")
9393
txlist[0][4 + 1] += 1
9494
assert_template(node, tmpl, txlist, 'bad-cb-missing')
9595
txlist[0][4 + 1] -= 1
9696

97-
# Test 3: Truncated final tx
97+
self.log.info("getblocktemplate: Test truncated final transaction")
9898
lastbyte = txlist[-1].pop()
9999
assert_raises_jsonrpc(-22, "Block decode failed", assert_template, node, tmpl, txlist, 'n/a')
100100
txlist[-1].append(lastbyte)
101101

102-
# Test 4: Add an invalid tx to the end (duplicate of gen tx)
102+
self.log.info("getblocktemplate: Test duplicate transaction")
103103
txlist.append(txlist[0])
104104
assert_template(node, tmpl, txlist, 'bad-txns-duplicate')
105105
txlist.pop()
106106

107-
# Test 5: Add an invalid tx to the end (non-duplicate)
107+
self.log.info("getblocktemplate: Test invalid transaction")
108108
txlist.append(bytearray(txlist[0]))
109109
txlist[-1][4 + 1] = 0xff
110110
assert_template(node, tmpl, txlist, 'bad-txns-inputs-missingorspent')
111111
txlist.pop()
112112

113-
# Test 6: Future tx lock time
113+
self.log.info("getblocktemplate: Test nonfinal transaction")
114114
txlist[0][-4:] = b'\xff\xff\xff\xff'
115115
assert_template(node, tmpl, txlist, 'bad-txns-nonfinal')
116116
txlist[0][-4:] = b'\0\0\0\0'
117117

118-
# Test 7: Bad tx count
118+
self.log.info("getblocktemplate: Test bad tx count")
119119
txlist.append(b'')
120120
assert_raises_jsonrpc(-22, 'Block decode failed', assert_template, node, tmpl, txlist, 'n/a')
121121
txlist.pop()
122122

123-
# Test 8: Bad bits
123+
self.log.info("getblocktemplate: Test bad bits")
124124
realbits = tmpl['bits']
125125
tmpl['bits'] = '1c0000ff' # impossible in the real world
126126
assert_template(node, tmpl, txlist, 'bad-diffbits')
127127
tmpl['bits'] = realbits
128128

129-
# Test 9: Bad merkle root
129+
self.log.info("getblocktemplate: Test bad merkle root")
130130
rawtmpl = template_to_bytearray(tmpl, txlist)
131131
rawtmpl[4 + 32] = (rawtmpl[4 + 32] + 1) % 0x100
132132
rsp = node.getblocktemplate({'data': b2x(rawtmpl), 'mode': 'proposal'})
133133
if rsp != 'bad-txnmrklroot':
134134
raise AssertionError('unexpected: %s' % (rsp,))
135135

136-
# Test 10: Bad timestamps
136+
self.log.info("getblocktemplate: Test bad timestamps")
137137
realtime = tmpl['curtime']
138138
tmpl['curtime'] = 0x7fffffff
139139
assert_template(node, tmpl, txlist, 'time-too-new')
140140
tmpl['curtime'] = 0
141141
assert_template(node, tmpl, txlist, 'time-too-old')
142142
tmpl['curtime'] = realtime
143143

144-
# Test 11: Valid block
144+
self.log.info("getblocktemplate: Test valid block")
145145
assert_template(node, tmpl, txlist, None)
146146

147-
# Test 12: Orphan block
147+
self.log.info("getblocktemplate: Test not best block")
148148
tmpl['previousblockhash'] = 'ff00' * 16
149149
assert_template(node, tmpl, txlist, 'inconclusive-not-best-prevblk')
150150

0 commit comments

Comments
 (0)