Skip to content

Commit 14398b3

Browse files
committed
test: add and harmonize getrawtransaction logging
1 parent 85d8869 commit 14398b3

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

test/functional/rpc_rawtransaction.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def setup_network(self):
7474
self.connect_nodes(0, 2)
7575

7676
def run_test(self):
77-
self.log.info('prepare some coins for multiple *rawtransaction commands')
77+
self.log.info("Prepare some coins for multiple *rawtransaction commands")
7878
self.nodes[2].generate(1)
7979
self.sync_all()
8080
self.nodes[0].generate(COINBASE_MATURITY + 1)
@@ -86,11 +86,11 @@ def run_test(self):
8686
self.nodes[0].generate(5)
8787
self.sync_all()
8888

89-
self.log.info('Test getrawtransaction on genesis block coinbase returns an error')
89+
self.log.info("Test getrawtransaction on genesis block coinbase returns an error")
9090
block = self.nodes[0].getblock(self.nodes[0].getblockhash(0))
9191
assert_raises_rpc_error(-5, "The genesis block coinbase is not considered an ordinary transaction", self.nodes[0].getrawtransaction, block['merkleroot'])
9292

93-
self.log.info('Check parameter types and required parameters of createrawtransaction')
93+
self.log.info("Test createrawtransaction")
9494
# Test `createrawtransaction` required parameters
9595
assert_raises_rpc_error(-1, "createrawtransaction", self.nodes[0].createrawtransaction)
9696
assert_raises_rpc_error(-1, "createrawtransaction", self.nodes[0].createrawtransaction, [])
@@ -146,7 +146,7 @@ def run_test(self):
146146
# Test `createrawtransaction` invalid `replaceable`
147147
assert_raises_rpc_error(-3, "Expected type bool", self.nodes[0].createrawtransaction, [], {}, 0, 'foo')
148148

149-
self.log.info('Check that createrawtransaction accepts an array and object as outputs')
149+
# Test that createrawtransaction accepts an array and object as outputs
150150
# One output
151151
tx = tx_from_hex(self.nodes[2].createrawtransaction(inputs=[{'txid': TXID, 'vout': 9}], outputs={address: 99}))
152152
assert_equal(len(tx.vout), 1)
@@ -170,13 +170,10 @@ def run_test(self):
170170
)
171171

172172
for type in ["bech32", "p2sh-segwit", "legacy"]:
173+
self.log.info(f"Test signrawtransactionwithwallet with missing prevtx info ({type})")
173174
addr = self.nodes[0].getnewaddress("", type)
174175
addrinfo = self.nodes[0].getaddressinfo(addr)
175176
pubkey = addrinfo["scriptPubKey"]
176-
177-
self.log.info('sendrawtransaction with missing prevtx info (%s)' %(type))
178-
179-
# Test `signrawtransactionwithwallet` invalid `prevtxs`
180177
inputs = [ {'txid' : TXID, 'vout' : 3, 'sequence' : 1000}]
181178
outputs = { self.nodes[0].getnewaddress() : 1 }
182179
rawtx = self.nodes[0].createrawtransaction(inputs, outputs)
@@ -224,7 +221,7 @@ def run_test(self):
224221
# sendrawtransaction with missing input #
225222
#########################################
226223

227-
self.log.info('sendrawtransaction with missing input')
224+
self.log.info("Test sendrawtransaction with missing input")
228225
inputs = [{'txid' : TXID, 'vout' : 1}] # won't exist
229226
outputs = { self.nodes[0].getnewaddress() : 4.998 }
230227
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
@@ -237,7 +234,7 @@ def run_test(self):
237234
# getrawtransaction with block hash #
238235
#####################################
239236

240-
# make a tx by sending then generate 2 blocks; block1 has the tx in it
237+
# Make a tx by sending, then generate 2 blocks; block1 has the tx in it
241238
tx = self.nodes[2].sendtoaddress(self.nodes[1].getnewaddress(), 1)
242239
block1, block2 = self.nodes[2].generate(2)
243240
self.sync_all()
@@ -277,6 +274,7 @@ def run_test(self):
277274
assert_equal(self.nodes[n].getbestblockhash(), block2)
278275

279276
if not self.options.descriptors:
277+
self.log.info("Test raw multisig transactions (legacy)")
280278
# The traditional multisig workflow does not work with descriptor wallets so these are legacy only.
281279
# The multisig workflow with descriptor wallets uses PSBTs and is tested elsewhere, no need to do them here.
282280
#########################
@@ -395,7 +393,7 @@ def run_test(self):
395393
self.sync_all()
396394
assert_equal(self.nodes[0].getbalance(), bal+Decimal('50.00000000')+Decimal('2.19000000')) #block reward + tx
397395

398-
# decoderawtransaction tests
396+
self.log.info("Test decoderawtransaction")
399397
# witness transaction
400398
encrawtx = "010000000001010000000000000072c1a6a246ae63f74f931e8365e15a089c68d61900000000000000000000ffffffff0100e1f50500000000000102616100000000"
401399
decrawtx = self.nodes[0].decoderawtransaction(encrawtx, True) # decode as witness transaction
@@ -413,7 +411,7 @@ def run_test(self):
413411
assert_equal(decrawtx, decrawtx_wit) # the witness interpretation should be chosen
414412
assert_equal(decrawtx['vin'][0]['coinbase'], "03c68708046ff8415c622f4254432e434f4d2ffabe6d6de1965d02c68f928e5b244ab1965115a36f56eb997633c7f690124bbf43644e23080000000ca3d3af6d005a65ff0200fd00000000")
415413

416-
# Basic signrawtransaction test
414+
self.log.info("Test signrawtransactionwithwallet")
417415
addr = self.nodes[1].getnewaddress()
418416
txid = self.nodes[0].sendtoaddress(addr, 10)
419417
self.nodes[0].generate(1)
@@ -458,6 +456,8 @@ def run_test(self):
458456
# TRANSACTION VERSION NUMBER TESTS #
459457
####################################
460458

459+
self.log.info("Test transaction version numbers")
460+
461461
# Test the minimum transaction version number that fits in a signed 32-bit integer.
462462
# As transaction version is unsigned, this should convert to its unsigned equivalent.
463463
tx = CTransaction()
@@ -473,7 +473,7 @@ def run_test(self):
473473
decrawtx = self.nodes[0].decoderawtransaction(rawtx)
474474
assert_equal(decrawtx['version'], 0x7fffffff)
475475

476-
self.log.info('sendrawtransaction/testmempoolaccept with maxfeerate')
476+
self.log.info("Test sendrawtransaction/testmempoolaccept with maxfeerate")
477477

478478
# Test a transaction with a small fee.
479479
txId = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1.0)
@@ -523,7 +523,7 @@ def run_test(self):
523523
assert_equal(testres['allowed'], True)
524524
self.nodes[2].sendrawtransaction(hexstring=rawTxSigned['hex'], maxfeerate='0.20000000')
525525

526-
self.log.info('sendrawtransaction/testmempoolaccept with tx that is already in the chain')
526+
self.log.info("Test sendrawtransaction/testmempoolaccept with tx already in the chain")
527527
self.nodes[2].generate(1)
528528
self.sync_blocks()
529529
for node in self.nodes:

0 commit comments

Comments
 (0)