From 259bf0cca740fac128d0364d106faa4e6e207cb2 Mon Sep 17 00:00:00 2001 From: Don Park Date: Mon, 23 Apr 2018 14:31:07 +0700 Subject: [PATCH 1/2] use a portion of the whole-number UTXOs to ensure a change output --- test/functional/wallet-hd.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/functional/wallet-hd.py b/test/functional/wallet-hd.py index c02d54d428c..389b5a6121c 100755 --- a/test/functional/wallet-hd.py +++ b/test/functional/wallet-hd.py @@ -92,13 +92,15 @@ def run_test (self): assert_equal(self.nodes[1].getbalance(), num_hd_adds + 1) # send a tx and make sure its using the internal chain for the changeoutput - txid = self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1) + signal_amount = 1.5 + txid = self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), signal_amount) outs = self.nodes[1].decoderawtransaction(self.nodes[1].gettransaction(txid)['hex'])['vout'] + assert_equal(len(outs), 2) # one payment and one change tx keypath = "" for out in outs: - if out['value'] != 1: + if out['value'] != signal_amount: keypath = self.nodes[1].validateaddress(out['scriptPubKey']['addresses'][0])['hdkeypath'] - + assert_equal(keypath[0:7], "m/0'/1'") if __name__ == '__main__': From 22008c024933c03408095c92e764d6e09f23a7c7 Mon Sep 17 00:00:00 2001 From: Don Park Date: Tue, 24 Apr 2018 20:05:41 +0700 Subject: [PATCH 2/2] make the wallet test aware of the 1000byte tx fee round-up --- test/functional/test_framework/util.py | 2 ++ test/functional/wallet.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index 688ef4981cd..e65f8ac7e36 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -26,6 +26,8 @@ def assert_fee_amount(fee, tx_size, fee_per_kB): """Assert the fee was in range""" + # dogecoin: tx_size <1000 is rounded up to 1000 + tx_size = tx_size if tx_size >= 1000 else 1000 target_fee = tx_size * fee_per_kB / 1000 if fee < target_fee: raise AssertionError("Fee of %s BTC too low! (Should be %s BTC)" % (str(fee), str(target_fee))) diff --git a/test/functional/wallet.py b/test/functional/wallet.py index 9e53dc11df8..d33cc07a63f 100755 --- a/test/functional/wallet.py +++ b/test/functional/wallet.py @@ -147,7 +147,7 @@ def run_test(self): # Send 100000 DOGE normal address = self.nodes[0].getnewaddress("test") - fee_per_byte = Decimal('1') + fee_per_byte = Decimal('0.001') self.nodes[2].settxfee(fee_per_byte * 1000) txid = self.nodes[2].sendtoaddress(address, 100000, "", "", False) self.nodes[2].generate(1)