Changeset View
Changeset View
Standalone View
Standalone View
test/functional/rpc_getblockstats.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2017-2019 The Bitcoin Core developers | # Copyright (c) 2017-2019 The Bitcoin Core developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
# | # | ||||
# Test getblockstats rpc call | # Test getblockstats rpc call | ||||
# | # | ||||
import decimal | import decimal | ||||
import json | import json | ||||
import os | import os | ||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import ( | from test_framework.util import assert_equal, assert_raises_rpc_error | ||||
assert_equal, | |||||
assert_raises_rpc_error, | |||||
) | |||||
TESTSDIR = os.path.dirname(os.path.realpath(__file__)) | TESTSDIR = os.path.dirname(os.path.realpath(__file__)) | ||||
def EncodeDecimal(o): | def EncodeDecimal(o): | ||||
if isinstance(o, decimal.Decimal): | if isinstance(o, decimal.Decimal): | ||||
# json.load will read a quoted float as a string and not convert it back | # json.load will read a quoted float as a string and not convert it back | ||||
# to decimal, so store the value as unquoted float instead. | # to decimal, so store the value as unquoted float instead. | ||||
▲ Show 20 Lines • Show All 175 Lines • Show Last 20 Lines |