mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Merge pull request #4315 from pravblockc/backports-v0.18-pr6
Backports v0.18 PR's: 14805, 14947 and 14953
This commit is contained in:
commit
ff2048a8be
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
# In case of a clean merge that is accepted by the user, the local branch with
|
# In case of a clean merge that is accepted by the user, the local branch with
|
||||||
# name $BRANCH is overwritten with the merged result, and optionally pushed.
|
# name $BRANCH is overwritten with the merged result, and optionally pushed.
|
||||||
from __future__ import division,print_function,unicode_literals
|
|
||||||
import os
|
import os
|
||||||
from sys import stdin,stdout,stderr
|
from sys import stdin,stdout,stderr
|
||||||
import argparse
|
import argparse
|
||||||
@ -23,10 +22,7 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import codecs
|
import codecs
|
||||||
try:
|
from urllib.request import Request, urlopen
|
||||||
from urllib.request import Request,urlopen
|
|
||||||
except:
|
|
||||||
from urllib2 import Request,urlopen
|
|
||||||
|
|
||||||
# External tools (can be overridden using environment)
|
# External tools (can be overridden using environment)
|
||||||
GIT = os.getenv('GIT','git')
|
GIT = os.getenv('GIT','git')
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
#
|
#
|
||||||
|
|
||||||
from __future__ import print_function, division
|
|
||||||
import struct
|
import struct
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
|
@ -7,11 +7,7 @@
|
|||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
#
|
#
|
||||||
|
|
||||||
from __future__ import print_function
|
from http.client import HttpConnection
|
||||||
try: # Python 3
|
|
||||||
import http.client as httplib
|
|
||||||
except ImportError: # Python 2
|
|
||||||
import httplib
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import base64
|
import base64
|
||||||
@ -31,7 +27,7 @@ class BitcoinRPC:
|
|||||||
authpair = "%s:%s" % (username, password)
|
authpair = "%s:%s" % (username, password)
|
||||||
authpair = authpair.encode('utf-8')
|
authpair = authpair.encode('utf-8')
|
||||||
self.authhdr = b"Basic " + base64.b64encode(authpair)
|
self.authhdr = b"Basic " + base64.b64encode(authpair)
|
||||||
self.conn = httplib.HTTPConnection(host, port=port, timeout=30)
|
self.conn = HttpConnection(host, port=port, timeout=30)
|
||||||
|
|
||||||
def execute(self, obj):
|
def execute(self, obj):
|
||||||
try:
|
try:
|
||||||
|
@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE(outbound_slow_chain_eviction)
|
|||||||
|
|
||||||
static void AddRandomOutboundPeer(std::vector<CNode *> &vNodes, PeerLogicValidation &peerLogic, CConnmanTest* connman)
|
static void AddRandomOutboundPeer(std::vector<CNode *> &vNodes, PeerLogicValidation &peerLogic, CConnmanTest* connman)
|
||||||
{
|
{
|
||||||
CAddress addr(ip(insecure_rand_ctx.randbits(32)), NODE_NONE);
|
CAddress addr(ip(g_insecure_rand_ctx.randbits(32)), NODE_NONE);
|
||||||
vNodes.emplace_back(new CNode(id++, ServiceFlags(NODE_NETWORK), 0, INVALID_SOCKET, addr, 0, 0, CAddress(), "", /*fInboundIn=*/ false));
|
vNodes.emplace_back(new CNode(id++, ServiceFlags(NODE_NETWORK), 0, INVALID_SOCKET, addr, 0, 0, CAddress(), "", /*fInboundIn=*/ false));
|
||||||
CNode &node = *vNodes.back();
|
CNode &node = *vNodes.back();
|
||||||
node.SetSendVersion(PROTOCOL_VERSION);
|
node.SetSendVersion(PROTOCOL_VERSION);
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <index/txindex.h>
|
#include <index/txindex.h>
|
||||||
#include <miner.h>
|
#include <miner.h>
|
||||||
#include <net_processing.h>
|
#include <net_processing.h>
|
||||||
|
#include <noui.h>
|
||||||
#include <pow.h>
|
#include <pow.h>
|
||||||
#include <rpc/register.h>
|
#include <rpc/register.h>
|
||||||
#include <rpc/server.h>
|
#include <rpc/server.h>
|
||||||
@ -30,10 +31,7 @@
|
|||||||
|
|
||||||
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||||
|
|
||||||
FastRandomContext insecure_rand_ctx;
|
thread_local FastRandomContext g_insecure_rand_ctx;
|
||||||
|
|
||||||
extern bool fPrintToConsole;
|
|
||||||
extern void noui_connect();
|
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, const uint256& num)
|
std::ostream& operator<<(std::ostream& os, const uint256& num)
|
||||||
{
|
{
|
||||||
@ -116,23 +114,23 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha
|
|||||||
|
|
||||||
TestingSetup::~TestingSetup()
|
TestingSetup::~TestingSetup()
|
||||||
{
|
{
|
||||||
llmq::InterruptLLMQSystem();
|
llmq::InterruptLLMQSystem();
|
||||||
llmq::StopLLMQSystem();
|
llmq::StopLLMQSystem();
|
||||||
g_txindex->Interrupt();
|
g_txindex->Interrupt();
|
||||||
g_txindex->Stop();
|
g_txindex->Stop();
|
||||||
g_txindex.reset();
|
g_txindex.reset();
|
||||||
threadGroup.interrupt_all();
|
threadGroup.interrupt_all();
|
||||||
threadGroup.join_all();
|
threadGroup.join_all();
|
||||||
StopScriptCheckWorkerThreads();
|
StopScriptCheckWorkerThreads();
|
||||||
GetMainSignals().FlushBackgroundCallbacks();
|
GetMainSignals().FlushBackgroundCallbacks();
|
||||||
GetMainSignals().UnregisterBackgroundSignalScheduler();
|
GetMainSignals().UnregisterBackgroundSignalScheduler();
|
||||||
g_connman.reset();
|
g_connman.reset();
|
||||||
g_banman.reset();
|
g_banman.reset();
|
||||||
UnloadBlockIndex();
|
UnloadBlockIndex();
|
||||||
pcoinsTip.reset();
|
pcoinsTip.reset();
|
||||||
llmq::DestroyLLMQSystem();
|
llmq::DestroyLLMQSystem();
|
||||||
pcoinsdbview.reset();
|
pcoinsdbview.reset();
|
||||||
pblocktree.reset();
|
pblocktree.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
TestChainSetup::TestChainSetup(int blockCount) : TestingSetup(CBaseChainParams::REGTEST)
|
TestChainSetup::TestChainSetup(int blockCount) : TestingSetup(CBaseChainParams::REGTEST)
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
extern FastRandomContext insecure_rand_ctx;
|
thread_local extern FastRandomContext g_insecure_rand_ctx;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag to make GetRand in random.h return the same number
|
* Flag to make GetRand in random.h return the same number
|
||||||
@ -28,14 +28,14 @@ extern bool g_mock_deterministic_tests;
|
|||||||
|
|
||||||
static inline void SeedInsecureRand(bool deterministic = false)
|
static inline void SeedInsecureRand(bool deterministic = false)
|
||||||
{
|
{
|
||||||
insecure_rand_ctx = FastRandomContext(deterministic);
|
g_insecure_rand_ctx = FastRandomContext(deterministic);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t InsecureRand32() { return insecure_rand_ctx.rand32(); }
|
static inline uint32_t InsecureRand32() { return g_insecure_rand_ctx.rand32(); }
|
||||||
static inline uint256 InsecureRand256() { return insecure_rand_ctx.rand256(); }
|
static inline uint256 InsecureRand256() { return g_insecure_rand_ctx.rand256(); }
|
||||||
static inline uint64_t InsecureRandBits(int bits) { return insecure_rand_ctx.randbits(bits); }
|
static inline uint64_t InsecureRandBits(int bits) { return g_insecure_rand_ctx.randbits(bits); }
|
||||||
static inline uint64_t InsecureRandRange(uint64_t range) { return insecure_rand_ctx.randrange(range); }
|
static inline uint64_t InsecureRandRange(uint64_t range) { return g_insecure_rand_ctx.randrange(range); }
|
||||||
static inline bool InsecureRandBool() { return insecure_rand_ctx.randbool(); }
|
static inline bool InsecureRandBool() { return g_insecure_rand_ctx.randbool(); }
|
||||||
|
|
||||||
static constexpr CAmount CENT{1000000};
|
static constexpr CAmount CENT{1000000};
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ class CConnman;
|
|||||||
class CNode;
|
class CNode;
|
||||||
|
|
||||||
class PeerLogicValidation;
|
class PeerLogicValidation;
|
||||||
struct TestingSetup: public BasicTestingSetup {
|
struct TestingSetup : public BasicTestingSetup {
|
||||||
boost::thread_group threadGroup;
|
boost::thread_group threadGroup;
|
||||||
CScheduler scheduler;
|
CScheduler scheduler;
|
||||||
|
|
||||||
|
@ -319,9 +319,9 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||||||
assert_equal(len(extra_confs), num_nodes)
|
assert_equal(len(extra_confs), num_nodes)
|
||||||
assert_equal(len(extra_args), num_nodes)
|
assert_equal(len(extra_args), num_nodes)
|
||||||
assert_equal(len(binary), num_nodes)
|
assert_equal(len(binary), num_nodes)
|
||||||
old_num_nodes = len(self.nodes)
|
|
||||||
for i in range(num_nodes):
|
for i in range(num_nodes):
|
||||||
self.nodes.append(TestNode(old_num_nodes + i, get_datadir_path(self.options.tmpdir, old_num_nodes + i), self.extra_args_from_options, chain=self.chain, rpchost=rpchost, timewait=self.rpc_timewait, bitcoind=binary[i], bitcoin_cli=self.options.bitcoincli, mocktime=self.mocktime, coverage_dir=self.options.coveragedir, extra_conf=extra_confs[i], extra_args=extra_args[i], use_cli=self.options.usecli))
|
numnode = len(self.nodes)
|
||||||
|
self.nodes.append(TestNode(numnode, get_datadir_path(self.options.tmpdir, numnode), self.extra_args_from_options, chain=self.chain, rpchost=rpchost, timewait=self.rpc_timewait, bitcoind=binary[i], bitcoin_cli=self.options.bitcoincli, mocktime=self.mocktime, coverage_dir=self.options.coveragedir, extra_conf=extra_confs[i], extra_args=extra_args[i], use_cli=self.options.usecli))
|
||||||
|
|
||||||
def start_node(self, i, *args, **kwargs):
|
def start_node(self, i, *args, **kwargs):
|
||||||
"""Start a dashd"""
|
"""Start a dashd"""
|
||||||
|
@ -9,14 +9,9 @@ Runs automatically during `make check`.
|
|||||||
|
|
||||||
Can also be run manually."""
|
Can also be run manually."""
|
||||||
|
|
||||||
from __future__ import division,print_function,unicode_literals
|
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import binascii
|
import binascii
|
||||||
try:
|
import configparser
|
||||||
import configparser
|
|
||||||
except ImportError:
|
|
||||||
import ConfigParser as configparser
|
|
||||||
import difflib
|
import difflib
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
Loading…
Reference in New Issue
Block a user