mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
Merge #17705: test: re-enable CLI test support by using EncodeDecimal in json.dumps()
b6f9e3576a1ea18572e4803aeb3f39330f0cb759 test: re-enable CLI test support by using EncodeDecimal in json.dumps() (fanquake) Pull request description: As mentioned in https://github.com/bitcoin/bitcoin/pull/17675#issuecomment-563188648. ACKs for top commit: practicalswift: ACK b6f9e3576a1ea18572e4803aeb3f39330f0cb759 assuming Travis is happy too -- diff looks correct :) MarcoFalke: > ACK b6f9e35 assuming Travis is happy too -- diff looks correct :) Tree-SHA512: 79fa535cc1756c8ee610a3d6a316a1c4f036797d6990a5620e44985393a2e52f78450f8e0021d0a148c08705fd1ba765508464a365f9030ae0d2cacbd7a93e19
This commit is contained in:
parent
6dbc9aba0d
commit
f08497c93e
@ -19,7 +19,6 @@ class MempoolPackagesTest(BitcoinTestFramework):
|
|||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
self.extra_args = [["-maxorphantxsize=100000"]]
|
self.extra_args = [["-maxorphantxsize=100000"]]
|
||||||
self.supports_cli = False
|
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
@ -17,7 +17,6 @@ class MempoolPackagesTest(BitcoinTestFramework):
|
|||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
self.extra_args = [["-maxorphantxsize=1000"], ["-maxorphantxsize=1000", "-limitancestorcount=5"]]
|
self.extra_args = [["-maxorphantxsize=1000"], ["-maxorphantxsize=1000", "-limitancestorcount=5"]]
|
||||||
self.supports_cli = False
|
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
@ -28,7 +28,6 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 4
|
self.num_nodes = 4
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.supports_cli = False
|
|
||||||
self.extra_args = [['-usehd=0']] * self.num_nodes
|
self.extra_args = [['-usehd=0']] * self.num_nodes
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
|
@ -16,7 +16,6 @@ class MerkleBlockTest(BitcoinTestFramework):
|
|||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
# Nodes 0/1 are "wallet" nodes, Nodes 2/3 are used for testing
|
# Nodes 0/1 are "wallet" nodes, Nodes 2/3 are used for testing
|
||||||
self.extra_args = [[], [], [], ["-txindex"]]
|
self.extra_args = [[], [], [], ["-txindex"]]
|
||||||
self.supports_cli = False
|
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
@ -30,7 +30,8 @@ from .util import (
|
|||||||
wait_until,
|
wait_until,
|
||||||
p2p_port,
|
p2p_port,
|
||||||
get_chain_folder,
|
get_chain_folder,
|
||||||
Options
|
Options,
|
||||||
|
EncodeDecimal,
|
||||||
)
|
)
|
||||||
|
|
||||||
BITCOIND_PROC_WAIT_TIMEOUT = 60
|
BITCOIND_PROC_WAIT_TIMEOUT = 60
|
||||||
@ -556,7 +557,7 @@ def arg_to_cli(arg):
|
|||||||
if isinstance(arg, bool):
|
if isinstance(arg, bool):
|
||||||
return str(arg).lower()
|
return str(arg).lower()
|
||||||
elif isinstance(arg, dict) or isinstance(arg, list):
|
elif isinstance(arg, dict) or isinstance(arg, list):
|
||||||
return json.dumps(arg)
|
return json.dumps(arg, default=EncodeDecimal)
|
||||||
else:
|
else:
|
||||||
return str(arg)
|
return str(arg)
|
||||||
|
|
||||||
|
@ -203,6 +203,11 @@ def check_json_precision():
|
|||||||
if satoshis != 2000000000000003:
|
if satoshis != 2000000000000003:
|
||||||
raise RuntimeError("JSON encode/decode loses precision")
|
raise RuntimeError("JSON encode/decode loses precision")
|
||||||
|
|
||||||
|
def EncodeDecimal(o):
|
||||||
|
if isinstance(o, Decimal):
|
||||||
|
return str(o)
|
||||||
|
raise TypeError(repr(o) + " is not JSON serializable")
|
||||||
|
|
||||||
def count_bytes(hex_string):
|
def count_bytes(hex_string):
|
||||||
return len(bytearray.fromhex(hex_string))
|
return len(bytearray.fromhex(hex_string))
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@ class AbandonConflictTest(BitcoinTestFramework):
|
|||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
self.extra_args = [["-minrelaytxfee=0.00001"], []]
|
self.extra_args = [["-minrelaytxfee=0.00001"], []]
|
||||||
self.supports_cli = False
|
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
@ -54,7 +54,6 @@ class WalletTest(BitcoinTestFramework):
|
|||||||
['-limitdescendantcount=3'], # Limit mempool descendants as a hack to have wallet txs rejected from the mempool
|
['-limitdescendantcount=3'], # Limit mempool descendants as a hack to have wallet txs rejected from the mempool
|
||||||
[],
|
[],
|
||||||
]
|
]
|
||||||
self.supports_cli = False
|
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
@ -27,7 +27,6 @@ from test_framework.util import (
|
|||||||
class ReorgsRestoreTest(BitcoinTestFramework):
|
class ReorgsRestoreTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 3
|
self.num_nodes = 3
|
||||||
self.supports_cli = False
|
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
self.skip_if_no_wallet()
|
||||||
|
Loading…
Reference in New Issue
Block a user