mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
00d2d7fac3
590bda79e876d9b959083105b8c7c41dd87706eb scripted-diff: Remove setup_clean_chain if default is not changed (Fabian Jahr) 98892f39e3d079c73bff7f2a5d5420fa95270497 doc: Improve setup_clean_chain documentation (Fabian Jahr) Pull request description: The first commit improves documentation on setup_clean_chain which is misunderstood quite frequently. Most importantly it fixes the TestShell docs which are simply incorrect. The second commit removes the instances of `setup_clean_clain` in functional tests where it is not changing the default. This used to be part of #19168 which also sought to rename`setup_clean_chain`. ACKs for top commit: jonatack: ACK 590bda79e876d9b959083105b8c7c41dd87706eb Tree-SHA512: a7881186e65d31160b8f84107fb185973b37c6e50f190a85c6e2906a13a7472bb4efa9440bd37fe0a9ac5cd2d1e8559870a7e4380632d9a249eca8980b945f3e
75 lines
2.9 KiB
Python
Executable File
75 lines
2.9 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# Copyright (c) 2018 The Bitcoin Core developers
|
|
# Distributed under the MIT software license, see the accompanying
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
from test_framework.test_framework import BitcoinTestFramework
|
|
from test_framework.util import (
|
|
assert_equal,
|
|
assert_raises_rpc_error,
|
|
)
|
|
|
|
|
|
class CreateTxWalletTest(BitcoinTestFramework):
|
|
def set_test_params(self):
|
|
self.num_nodes = 1
|
|
|
|
def skip_test_if_missing_module(self):
|
|
self.skip_if_no_wallet()
|
|
|
|
def run_test(self):
|
|
self.test_anti_fee_sniping()
|
|
self.test_tx_size_too_large()
|
|
|
|
def test_anti_fee_sniping(self):
|
|
self.log.info('Check that we have some (old) blocks and that anti-fee-sniping is disabled')
|
|
self.bump_mocktime(8 * 60 * 60 + 1)
|
|
assert_equal(self.nodes[0].getblockchaininfo()['blocks'], 200)
|
|
txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1)
|
|
tx = self.nodes[0].decoderawtransaction(self.nodes[0].gettransaction(txid)['hex'])
|
|
assert_equal(tx['locktime'], 0)
|
|
|
|
self.log.info('Check that anti-fee-sniping is enabled when we mine a recent block')
|
|
self.nodes[0].generate(1)
|
|
txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1)
|
|
tx = self.nodes[0].decoderawtransaction(self.nodes[0].gettransaction(txid)['hex'])
|
|
assert 0 < tx['locktime'] <= 201
|
|
|
|
def test_tx_size_too_large(self):
|
|
# More than 10kB of outputs, so that we hit -maxtxfee with a high feerate
|
|
outputs = {self.nodes[0].getnewaddress(): 0.000025 for i in range(400)}
|
|
raw_tx = self.nodes[0].createrawtransaction(inputs=[], outputs=outputs)
|
|
|
|
for fee_setting in ['-minrelaytxfee=0.01', '-mintxfee=0.01', '-paytxfee=0.01']:
|
|
self.log.info('Check maxtxfee in combination with {}'.format(fee_setting))
|
|
self.restart_node(0, extra_args=[fee_setting])
|
|
assert_raises_rpc_error(
|
|
-6,
|
|
"Fee exceeds maximum configured by -maxtxfee",
|
|
lambda: self.nodes[0].sendmany(dummy="", amounts=outputs),
|
|
)
|
|
assert_raises_rpc_error(
|
|
-4,
|
|
"Fee exceeds maximum configured by -maxtxfee",
|
|
lambda: self.nodes[0].fundrawtransaction(hexstring=raw_tx),
|
|
)
|
|
|
|
self.log.info('Check maxtxfee in combination with settxfee')
|
|
self.restart_node(0)
|
|
self.nodes[0].settxfee(0.01)
|
|
assert_raises_rpc_error(
|
|
-6,
|
|
"Fee exceeds maximum configured by -maxtxfee",
|
|
lambda: self.nodes[0].sendmany(dummy="", amounts=outputs),
|
|
)
|
|
assert_raises_rpc_error(
|
|
-4,
|
|
"Fee exceeds maximum configured by -maxtxfee",
|
|
lambda: self.nodes[0].fundrawtransaction(hexstring=raw_tx),
|
|
)
|
|
self.nodes[0].settxfee(0)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
CreateTxWalletTest().main()
|