Repository: dogecoin/dogecoin
File: qa/rpc-tests/paytxfee.py (Python)

Code before:
#!/usr/bin/env python3
# Copyright (c) 2021 The Dogecoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""PayTxFee QA test.

# Tests wallet behavior of -paytxfee in relation to -mintxfee
"""

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from decimal import Decimal

class PayTxFeeTest(BitcoinTestFramework):

    def __init__(self):
        super().__init__()
        self.setup_clean_chain = True
        self.num_nodes = 4

    def setup_network(self, split=False):
        self.nodes = [] # all nodes have minrelaytxfee of 0.1

        # node 0 has txindex to track txs
        self.nodes.append(start_node(0, self.options.tmpdir,
            ["-minrelaytxfee=0.1", "-debug", '-txindex']))

        # node 1 pays 0.1 DOGE on all txs due to implicit mintxfee = paytxfee
        self.nodes.append(start_node(1, self.options.tmpdir,
            ["-paytxfee=0.1", "-minrelaytxfee=0.1", "-debug"]))

        # node 2 will always pay 1 DOGE on all txs because of explicit mintxfee
        self.nodes.append(start_node(2, self.options.tmpdir,
            ["-mintxfee=1", "-paytxfee=0.1", "-minrelaytxfee=0.1", "-debug"]))

        # node 3 will always pay 0.1 DOGE on all txs despite explicit mintxfee of 0.01
        self.nodes.append(start_node(3, self.options.tmpdir,
            ["-mintxfee=0.01", "-paytxfee=0.1", "-minrelaytxfee=0.1", "-debug"]))

        # connect nodes
        connect_nodes_bi(self.nodes,0,1)
        connect_nodes_bi(self.nodes,1,2)
        connect_nodes_bi(self.nodes,0,2)
        connect_nodes_bi(self.nodes,0,3)
        connect_nodes_bi(self.nodes,1,3)
        connect_nodes_bi(self.nodes,2,3)


Review comment (suggestion):
```suggestion
        self.nodes = [] # all nodes will be configured with minrelaytxfee of 0.001
```


Code after:
#!/usr/bin/env python3
# Copyright (c) 2021 The Dogecoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""PayTxFee QA test.

# Tests wallet behavior of -paytxfee in relation to -mintxfee
"""

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from decimal import Decimal

class PayTxFeeTest(BitcoinTestFramework):

    def __init__(self):
        super().__init__()
        self.setup_clean_chain = True
        self.num_nodes = 4

    def setup_nodes(self, split=False):
        nodes = []

        # node 0 has txindex to track txs
        nodes.append(start_node(0, self.options.tmpdir,
            ["-debug", '-txindex']))

        # node 1 pays 0.1 DOGE on all txs due to implicit mintxfee = paytxfee
        nodes.append(start_node(1, self.options.tmpdir,
            ["-paytxfee=0.1", "-debug"]))

        # node 2 will always pay 1 DOGE on all txs because of explicit mintxfee
        nodes.append(start_node(2, self.options.tmpdir,
            ["-mintxfee=1", "-paytxfee=0.1", "-debug"]))

        # node 3 will always pay 0.1 DOGE on all txs despite explicit mintxfee of 0.01
        nodes.append(start_node(3, self.options.tmpdir,
            ["-mintxfee=0.01", "-paytxfee=0.1", "-debug"]))

        return nodes

    def run_test(self):

        seed = 1000 # the amount to seed wallets with
        amount = 995 # the amount to send back
        targetAddress = self.nodes[0].getnewaddress()