mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
4a3e3af6e7
fa0074e2d82928016a43ca408717154a1c70a4db scripted-diff: Bump copyright headers (MarcoFalke) Pull request description: Needs to be done because no one has removed the years yet ACKs for top commit: practicalswift: ACK fa0074e2d82928016a43ca408717154a1c70a4db Tree-SHA512: 210e92acd7d400b556cf8259c3ec9967797420cfd19f0c2a4fa54cb2b3d32ad9ae27e771269201e7d554c0f4cd73a8b1c1a42c9f65d8685ca4d52e5134b071a3
36 lines
1.4 KiB
Python
Executable File
36 lines
1.4 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# Copyright (c) 2018-2020 The Bitcoin Core developers
|
|
# Distributed under the MIT software license, see the accompanying
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
"""Test dashd shutdown."""
|
|
|
|
from test_framework.test_framework import BitcoinTestFramework
|
|
from test_framework.util import assert_equal, get_rpc_proxy
|
|
from threading import Thread
|
|
|
|
def test_long_call(node):
|
|
block = node.waitfornewblock()
|
|
assert_equal(block['height'], 0)
|
|
|
|
class ShutdownTest(BitcoinTestFramework):
|
|
|
|
def set_test_params(self):
|
|
self.setup_clean_chain = True
|
|
self.num_nodes = 1
|
|
self.supports_cli = False
|
|
|
|
def run_test(self):
|
|
node = get_rpc_proxy(self.nodes[0].url, 1, timeout=600, coveragedir=self.nodes[0].coverage_dir)
|
|
# Force connection establishment by executing a dummy command.
|
|
node.getblockcount()
|
|
Thread(target=test_long_call, args=(node,)).start()
|
|
# Wait until the server is executing the above `waitfornewblock`.
|
|
self.wait_until(lambda: len(self.nodes[0].getrpcinfo()['active_commands']) == 2)
|
|
# Wait 1 second after requesting shutdown but not before the `stop` call
|
|
# finishes. This is to ensure event loop waits for current connections
|
|
# to close.
|
|
self.stop_node(0, wait=1000)
|
|
|
|
if __name__ == '__main__':
|
|
ShutdownTest().main()
|