@@ -44,6 +44,7 @@ def setup_network(self):
44
44
connect_nodes (self .nodes [0 ], self .nodes [3 ])
45
45
46
46
def run_test (self ):
47
+ self .log .info ("Connect nodes, set fees, generate blocks, and sync" )
47
48
self .min_relay_tx_fee = self .nodes [0 ].getnetworkinfo ()['relayfee' ]
48
49
# This test is not meant to test fee estimation and we'd like
49
50
# to be sure all txs are sent at a consistent desired feerate
@@ -95,6 +96,7 @@ def run_test(self):
95
96
def test_change_position (self ):
96
97
# ensure that setting changePosition in fundraw with an exact match is
97
98
# handled properly
99
+ self .log .info ("Test fundrawtxn changePosition option" )
98
100
rawmatch = self .nodes [2 ].createrawtransaction (
99
101
[], {self .nodes [2 ].getnewaddress (): 50 })
100
102
rawmatch = self .nodes [2 ].fundrawtransaction (
@@ -130,6 +132,7 @@ def test_simple(self):
130
132
#
131
133
# simple test #
132
134
#
135
+ self .log .info ("Test fundrawtxn" )
133
136
inputs = []
134
137
outputs = {self .nodes [0 ].getnewaddress (): 1.0 }
135
138
rawTx = self .nodes [2 ].createrawtransaction (inputs , outputs )
@@ -143,6 +146,7 @@ def test_simple_two_coins(self):
143
146
#
144
147
# simple test with two coins #
145
148
#
149
+ self .log .info ("Test fundrawtxn with 2 coins" )
146
150
inputs = []
147
151
outputs = {self .nodes [0 ].getnewaddress (): 2.2 }
148
152
rawTx = self .nodes [2 ].createrawtransaction (inputs , outputs )
@@ -158,6 +162,7 @@ def test_simple_two_outputs(self):
158
162
#
159
163
# simple test with two outputs #
160
164
#
165
+ self .log .info ("Test fundrawtxn with 2 outputs" )
161
166
inputs = []
162
167
outputs = {
163
168
self .nodes [0 ].getnewaddress (): 2.6 , self .nodes [1 ].getnewaddress (): 2.5 }
@@ -177,6 +182,7 @@ def test_change(self):
177
182
#
178
183
# test a fundrawtransaction with a VIN greater than the required amount #
179
184
#
185
+ self .log .info ("Test fundrawtxn with a vin > required amount" )
180
186
utx = get_unspent (self .nodes [2 ].listunspent (), 5 )
181
187
182
188
inputs = [{'txid' : utx ['txid' ], 'vout' : utx ['vout' ]}]
@@ -201,6 +207,7 @@ def test_no_change(self):
201
207
#
202
208
# test a fundrawtransaction with which will not get a change output #
203
209
#
210
+ self .log .info ("Test fundrawtxn not having a change output" )
204
211
utx = get_unspent (self .nodes [2 ].listunspent (), 5 )
205
212
206
213
inputs = [{'txid' : utx ['txid' ], 'vout' : utx ['vout' ]}]
@@ -227,6 +234,7 @@ def test_invalid_option(self):
227
234
#
228
235
# test a fundrawtransaction with an invalid option #
229
236
#
237
+ self .log .info ("Test fundrawtxn with an invalid option" )
230
238
utx = get_unspent (self .nodes [2 ].listunspent (), 5 )
231
239
232
240
inputs = [{'txid' : utx ['txid' ], 'vout' : utx ['vout' ]}]
@@ -247,6 +255,7 @@ def test_invalid_change_address(self):
247
255
#
248
256
# test a fundrawtransaction with an invalid change address #
249
257
#
258
+ self .log .info ("Test fundrawtxn with an invalid change address" )
250
259
utx = get_unspent (self .nodes [2 ].listunspent (), 5 )
251
260
252
261
inputs = [{'txid' : utx ['txid' ], 'vout' : utx ['vout' ]}]
@@ -263,6 +272,7 @@ def test_valid_change_address(self):
263
272
#
264
273
# test a fundrawtransaction with a provided change address #
265
274
#
275
+ self .log .info ("Test fundrawtxn with a provided change address" )
266
276
utx = get_unspent (self .nodes [2 ].listunspent (), 5 )
267
277
268
278
inputs = [{'txid' : utx ['txid' ], 'vout' : utx ['vout' ]}]
@@ -284,6 +294,7 @@ def test_coin_selection(self):
284
294
#
285
295
# test a fundrawtransaction with a VIN smaller than the required amount #
286
296
#
297
+ self .log .info ("Test fundrawtxn with a vin < required amount" )
287
298
utx = get_unspent (self .nodes [2 ].listunspent (), 1 )
288
299
289
300
inputs = [{'txid' : utx ['txid' ], 'vout' : utx ['vout' ]}]
@@ -318,6 +329,7 @@ def test_two_vin(self):
318
329
#
319
330
# test a fundrawtransaction with two VINs #
320
331
#
332
+ self .log .info ("Test fundrawtxn with 2 vins" )
321
333
utx = get_unspent (self .nodes [2 ].listunspent (), 1 )
322
334
utx2 = get_unspent (self .nodes [2 ].listunspent (), 5 )
323
335
@@ -353,6 +365,7 @@ def test_two_vin_two_vout(self):
353
365
#
354
366
# test a fundrawtransaction with two VINs and two vOUTs #
355
367
#
368
+ self .log .info ("Test fundrawtxn with 2 vins and 2 vouts" )
356
369
utx = get_unspent (self .nodes [2 ].listunspent (), 1 )
357
370
utx2 = get_unspent (self .nodes [2 ].listunspent (), 5 )
358
371
@@ -380,7 +393,7 @@ def test_invalid_input(self):
380
393
#
381
394
# test a fundrawtransaction with invalid vin #
382
395
#
383
- # invalid vin!
396
+ self . log . info ( "Test fundrawtxn with an invalid vin" )
384
397
inputs = [
385
398
{'txid' : "1c7f966dab21119bac53213a2bc7532bff1fa844c124fd750a7d0b1332440bd1" , 'vout' : 0 }]
386
399
outputs = {self .nodes [0 ].getnewaddress (): 1.0 }
@@ -393,6 +406,7 @@ def test_fee_p2pkh(self):
393
406
#
394
407
# compare fee of a standard pubkeyhash transaction
395
408
#
409
+ self .log .info ("Test fundrawtxn p2pkh fee" )
396
410
inputs = []
397
411
outputs = {self .nodes [1 ].getnewaddress (): 1.1 }
398
412
rawTx = self .nodes [0 ].createrawtransaction (inputs , outputs )
@@ -411,11 +425,18 @@ def test_fee_p2pkh_multi_out(self):
411
425
# compare fee of a standard pubkeyhash transaction with multiple
412
426
# outputs
413
427
#
428
+ self .log .info ("Test fundrawtxn p2pkh fee with multiple outputs" )
414
429
inputs = []
415
- outputs = {self .nodes [1 ].getnewaddress (): 1.1 , self .nodes [1 ].getnewaddress (): 1.2 , self .nodes [1 ].getnewaddress (): 0.1 , self .nodes [
416
- 1 ].getnewaddress (): 1.3 , self .nodes [1 ].getnewaddress (): 0.2 , self .nodes [1 ].getnewaddress (): 0.3 }
417
- rawTx = self .nodes [0 ].createrawtransaction (inputs , outputs )
418
- fundedTx = self .nodes [0 ].fundrawtransaction (rawTx )
430
+ outputs = {
431
+ self .nodes [1 ].getnewaddress (): 1.1 ,
432
+ self .nodes [1 ].getnewaddress (): 1.2 ,
433
+ self .nodes [1 ].getnewaddress (): 0.1 ,
434
+ self .nodes [1 ].getnewaddress (): 1.3 ,
435
+ self .nodes [1 ].getnewaddress (): 0.2 ,
436
+ self .nodes [1 ].getnewaddress (): 0.3 ,
437
+ }
438
+ rawtx = self .nodes [0 ].createrawtransaction (inputs , outputs )
439
+ fundedTx = self .nodes [0 ].fundrawtransaction (rawtx )
419
440
# create same transaction over sendtoaddress
420
441
txId = self .nodes [0 ].sendmany ("" , outputs )
421
442
signedFee = self .nodes [0 ].getrawmempool (True )[txId ]['fee' ]
@@ -456,6 +477,7 @@ def test_fee_4of5(self):
456
477
#
457
478
# compare fee of a standard pubkeyhash transaction
458
479
#
480
+ self .log .info ("Test fundrawtxn fee with 4-of-5 addresses" )
459
481
460
482
# create 4of5 addr
461
483
addr1 = self .nodes [1 ].getnewaddress ()
@@ -471,7 +493,15 @@ def test_fee_4of5(self):
471
493
addr5Obj = self .nodes [1 ].getaddressinfo (addr5 )
472
494
473
495
mSigObj = self .nodes [1 ].addmultisigaddress (
474
- 4 , [addr1Obj ['pubkey' ], addr2Obj ['pubkey' ], addr3Obj ['pubkey' ], addr4Obj ['pubkey' ], addr5Obj ['pubkey' ]])['address' ]
496
+ 4 ,
497
+ [
498
+ addr1Obj ['pubkey' ],
499
+ addr2Obj ['pubkey' ],
500
+ addr3Obj ['pubkey' ],
501
+ addr4Obj ['pubkey' ],
502
+ addr5Obj ['pubkey' ],
503
+ ]
504
+ )['address' ]
475
505
476
506
inputs = []
477
507
outputs = {mSigObj : 1.1 }
@@ -490,6 +520,7 @@ def test_spend_2of2(self):
490
520
#
491
521
# spend a 2of2 multisig transaction over fundraw
492
522
#
523
+ self .log .info ("Test fundrawtxn spending 2-of-2 multisig" )
493
524
494
525
# create 2of2 addr
495
526
addr1 = self .nodes [2 ].getnewaddress ()
@@ -499,7 +530,12 @@ def test_spend_2of2(self):
499
530
addr2Obj = self .nodes [2 ].getaddressinfo (addr2 )
500
531
501
532
mSigObj = self .nodes [2 ].addmultisigaddress (
502
- 2 , [addr1Obj ['pubkey' ], addr2Obj ['pubkey' ]])['address' ]
533
+ 2 ,
534
+ [
535
+ addr1Obj ['pubkey' ],
536
+ addr2Obj ['pubkey' ],
537
+ ]
538
+ )['address' ]
503
539
504
540
# send 1.2 BCH to msig addr
505
541
self .nodes [0 ].sendtoaddress (mSigObj , 1.2 )
@@ -527,6 +563,8 @@ def test_locked_wallet(self):
527
563
#
528
564
# locked wallet test
529
565
#
566
+ self .log .info ("Test fundrawtxn with locked wallet" )
567
+
530
568
self .nodes [1 ].encryptwallet ("test" )
531
569
self .stop_nodes ()
532
570
@@ -588,6 +626,7 @@ def test_many_inputs_fee(self):
588
626
#
589
627
# multiple (~19) inputs tx test | Compare fee #
590
628
#
629
+ self .log .info ("Test fundrawtxn fee with many inputs" )
591
630
592
631
# empty node1, send some small coins from node0 to node1
593
632
self .nodes [1 ].sendtoaddress (
@@ -621,6 +660,7 @@ def test_many_inputs_send(self):
621
660
#
622
661
# multiple (~19) inputs tx test | sign/send #
623
662
#
663
+ self .log .info ("Test fundrawtxn sign+send with many inputs" )
624
664
625
665
# again, empty node1, send some small coins from node0 to node1
626
666
self .nodes [1 ].sendtoaddress (
@@ -655,6 +695,7 @@ def test_op_return(self):
655
695
#
656
696
# test fundrawtransaction with OP_RETURN and no vin #
657
697
#
698
+ self .log .info ("Test fundrawtxn with OP_RETURN and no vin" )
658
699
659
700
rawTx = "0100000000010000000000000000066a047465737400000000"
660
701
dec_tx = self .nodes [2 ].decoderawtransaction (rawTx )
@@ -674,6 +715,7 @@ def test_watchonly(self):
674
715
#
675
716
# test a fundrawtransaction using only watchonly #
676
717
#
718
+ self .log .info ("Test fundrawtxn using only watchonly" )
677
719
678
720
inputs = []
679
721
outputs = {self .nodes [2 ].getnewaddress (): self .watchonly_amount / 2 }
@@ -692,6 +734,7 @@ def test_all_watched_funds(self):
692
734
#
693
735
# test fundrawtransaction using the entirety of watched funds #
694
736
#
737
+ self .log .info ("Test fundrawtxn using entirety of watched funds" )
695
738
696
739
inputs = []
697
740
outputs = {self .nodes [2 ].getnewaddress (): self .watchonly_amount }
@@ -721,6 +764,7 @@ def test_option_feerate(self):
721
764
#
722
765
# Test feeRate option #
723
766
#
767
+ self .log .info ("Test fundrawtxn feeRate option" )
724
768
725
769
# Make sure there is exactly one input so coin selection can't skew the
726
770
# result
@@ -755,6 +799,7 @@ def test_address_reuse(self):
755
799
#
756
800
# Test no address reuse occurs #
757
801
#
802
+ self .log .info ("Test fundrawtxn does not reuse addresses" )
758
803
759
804
rawTx = self .nodes [3 ].createrawtransaction (
760
805
inputs = [], outputs = {self .nodes [3 ].getnewaddress (): 1 })
@@ -773,6 +818,7 @@ def test_option_subtract_fee_from_outputs(self):
773
818
#
774
819
# Test subtractFeeFromOutputs option #
775
820
#
821
+ self .log .info ("Test fundrawtxn subtractFeeFromOutputs option" )
776
822
777
823
# Make sure there is exactly one input so coin selection can't skew the
778
824
# result
0 commit comments