diff --git a/test/functional/rpc_fundrawtransaction.py b/test/functional/rpc_fundrawtransaction.py --- a/test/functional/rpc_fundrawtransaction.py +++ b/test/functional/rpc_fundrawtransaction.py @@ -44,6 +44,7 @@ connect_nodes(self.nodes[0], self.nodes[3]) def run_test(self): + self.log.info("Connect nodes, set fees, generate blocks, and sync") self.min_relay_tx_fee = self.nodes[0].getnetworkinfo()['relayfee'] # This test is not meant to test fee estimation and we'd like # to be sure all txs are sent at a consistent desired feerate @@ -95,6 +96,7 @@ def test_change_position(self): # ensure that setting changePosition in fundraw with an exact match is # handled properly + self.log.info("Test fundrawtxn changePosition option") rawmatch = self.nodes[2].createrawtransaction( [], {self.nodes[2].getnewaddress(): 50}) rawmatch = self.nodes[2].fundrawtransaction( @@ -130,6 +132,7 @@ # # simple test # # + self.log.info("Test fundrawtxn") inputs = [] outputs = {self.nodes[0].getnewaddress(): 1.0} rawTx = self.nodes[2].createrawtransaction(inputs, outputs) @@ -143,6 +146,7 @@ # # simple test with two coins # # + self.log.info("Test fundrawtxn with 2 coins") inputs = [] outputs = {self.nodes[0].getnewaddress(): 2.2} rawTx = self.nodes[2].createrawtransaction(inputs, outputs) @@ -158,6 +162,7 @@ # # simple test with two outputs # # + self.log.info("Test fundrawtxn with 2 outputs") inputs = [] outputs = { self.nodes[0].getnewaddress(): 2.6, self.nodes[1].getnewaddress(): 2.5} @@ -177,6 +182,7 @@ # # test a fundrawtransaction with a VIN greater than the required amount # # + self.log.info("Test fundrawtxn with a vin > required amount") utx = get_unspent(self.nodes[2].listunspent(), 5) inputs = [{'txid': utx['txid'], 'vout': utx['vout']}] @@ -201,6 +207,7 @@ # # test a fundrawtransaction with which will not get a change output # # + self.log.info("Test fundrawtxn not having a change output") utx = get_unspent(self.nodes[2].listunspent(), 5) inputs = [{'txid': utx['txid'], 'vout': utx['vout']}] @@ -227,6 +234,7 @@ # # test a fundrawtransaction with an invalid option # # + self.log.info("Test fundrawtxn with an invalid option") utx = get_unspent(self.nodes[2].listunspent(), 5) inputs = [{'txid': utx['txid'], 'vout': utx['vout']}] @@ -247,6 +255,7 @@ # # test a fundrawtransaction with an invalid change address # # + self.log.info("Test fundrawtxn with an invalid change address") utx = get_unspent(self.nodes[2].listunspent(), 5) inputs = [{'txid': utx['txid'], 'vout': utx['vout']}] @@ -263,6 +272,7 @@ # # test a fundrawtransaction with a provided change address # # + self.log.info("Test fundrawtxn with a provided change address") utx = get_unspent(self.nodes[2].listunspent(), 5) inputs = [{'txid': utx['txid'], 'vout': utx['vout']}] @@ -284,6 +294,7 @@ # # test a fundrawtransaction with a VIN smaller than the required amount # # + self.log.info("Test fundrawtxn with a vin < required amount") utx = get_unspent(self.nodes[2].listunspent(), 1) inputs = [{'txid': utx['txid'], 'vout': utx['vout']}] @@ -318,6 +329,7 @@ # # test a fundrawtransaction with two VINs # # + self.log.info("Test fundrawtxn with 2 vins") utx = get_unspent(self.nodes[2].listunspent(), 1) utx2 = get_unspent(self.nodes[2].listunspent(), 5) @@ -353,6 +365,7 @@ # # test a fundrawtransaction with two VINs and two vOUTs # # + self.log.info("Test fundrawtxn with 2 vins and 2 vouts") utx = get_unspent(self.nodes[2].listunspent(), 1) utx2 = get_unspent(self.nodes[2].listunspent(), 5) @@ -380,7 +393,7 @@ # # test a fundrawtransaction with invalid vin # # - # invalid vin! + self.log.info("Test fundrawtxn with an invalid vin") inputs = [ {'txid': "1c7f966dab21119bac53213a2bc7532bff1fa844c124fd750a7d0b1332440bd1", 'vout': 0}] outputs = {self.nodes[0].getnewaddress(): 1.0} @@ -393,6 +406,7 @@ # # compare fee of a standard pubkeyhash transaction # + self.log.info("Test fundrawtxn p2pkh fee") inputs = [] outputs = {self.nodes[1].getnewaddress(): 1.1} rawTx = self.nodes[0].createrawtransaction(inputs, outputs) @@ -411,11 +425,18 @@ # compare fee of a standard pubkeyhash transaction with multiple # outputs # + self.log.info("Test fundrawtxn p2pkh fee with multiple outputs") inputs = [] - outputs = {self.nodes[1].getnewaddress(): 1.1, self.nodes[1].getnewaddress(): 1.2, self.nodes[1].getnewaddress(): 0.1, self.nodes[ - 1].getnewaddress(): 1.3, self.nodes[1].getnewaddress(): 0.2, self.nodes[1].getnewaddress(): 0.3} - rawTx = self.nodes[0].createrawtransaction(inputs, outputs) - fundedTx = self.nodes[0].fundrawtransaction(rawTx) + outputs = { + self.nodes[1].getnewaddress(): 1.1, + self.nodes[1].getnewaddress(): 1.2, + self.nodes[1].getnewaddress(): 0.1, + self.nodes[1].getnewaddress(): 1.3, + self.nodes[1].getnewaddress(): 0.2, + self.nodes[1].getnewaddress(): 0.3, + } + rawtx = self.nodes[0].createrawtransaction(inputs, outputs) + fundedTx = self.nodes[0].fundrawtransaction(rawtx) # create same transaction over sendtoaddress txId = self.nodes[0].sendmany("", outputs) signedFee = self.nodes[0].getrawmempool(True)[txId]['fee'] @@ -456,6 +477,7 @@ # # compare fee of a standard pubkeyhash transaction # + self.log.info("Test fundrawtxn fee with 4-of-5 addresses") # create 4of5 addr addr1 = self.nodes[1].getnewaddress() @@ -471,7 +493,15 @@ addr5Obj = self.nodes[1].getaddressinfo(addr5) mSigObj = self.nodes[1].addmultisigaddress( - 4, [addr1Obj['pubkey'], addr2Obj['pubkey'], addr3Obj['pubkey'], addr4Obj['pubkey'], addr5Obj['pubkey']])['address'] + 4, + [ + addr1Obj['pubkey'], + addr2Obj['pubkey'], + addr3Obj['pubkey'], + addr4Obj['pubkey'], + addr5Obj['pubkey'], + ] + )['address'] inputs = [] outputs = {mSigObj: 1.1} @@ -490,6 +520,7 @@ # # spend a 2of2 multisig transaction over fundraw # + self.log.info("Test fundrawtxn spending 2-of-2 multisig") # create 2of2 addr addr1 = self.nodes[2].getnewaddress() @@ -499,7 +530,12 @@ addr2Obj = self.nodes[2].getaddressinfo(addr2) mSigObj = self.nodes[2].addmultisigaddress( - 2, [addr1Obj['pubkey'], addr2Obj['pubkey']])['address'] + 2, + [ + addr1Obj['pubkey'], + addr2Obj['pubkey'], + ] + )['address'] # send 1.2 BCH to msig addr self.nodes[0].sendtoaddress(mSigObj, 1.2) @@ -527,6 +563,8 @@ # # locked wallet test # + self.log.info("Test fundrawtxn with locked wallet") + self.nodes[1].encryptwallet("test") self.stop_nodes() @@ -588,6 +626,7 @@ # # multiple (~19) inputs tx test | Compare fee # # + self.log.info("Test fundrawtxn fee with many inputs") # empty node1, send some small coins from node0 to node1 self.nodes[1].sendtoaddress( @@ -621,6 +660,7 @@ # # multiple (~19) inputs tx test | sign/send # # + self.log.info("Test fundrawtxn sign+send with many inputs") # again, empty node1, send some small coins from node0 to node1 self.nodes[1].sendtoaddress( @@ -655,6 +695,7 @@ # # test fundrawtransaction with OP_RETURN and no vin # # + self.log.info("Test fundrawtxn with OP_RETURN and no vin") rawTx = "0100000000010000000000000000066a047465737400000000" dec_tx = self.nodes[2].decoderawtransaction(rawTx) @@ -674,6 +715,7 @@ # # test a fundrawtransaction using only watchonly # # + self.log.info("Test fundrawtxn using only watchonly") inputs = [] outputs = {self.nodes[2].getnewaddress(): self.watchonly_amount / 2} @@ -692,6 +734,7 @@ # # test fundrawtransaction using the entirety of watched funds # # + self.log.info("Test fundrawtxn using entirety of watched funds") inputs = [] outputs = {self.nodes[2].getnewaddress(): self.watchonly_amount} @@ -721,6 +764,7 @@ # # Test feeRate option # # + self.log.info("Test fundrawtxn feeRate option") # Make sure there is exactly one input so coin selection can't skew the # result @@ -755,6 +799,7 @@ # # Test no address reuse occurs # # + self.log.info("Test fundrawtxn does not reuse addresses") rawTx = self.nodes[3].createrawtransaction( inputs=[], outputs={self.nodes[3].getnewaddress(): 1}) @@ -773,6 +818,7 @@ # # Test subtractFeeFromOutputs option # # + self.log.info("Test fundrawtxn subtractFeeFromOutputs option") # Make sure there is exactly one input so coin selection can't skew the # result