mirror of
https://github.com/dogecoin/dogecoin.git
synced 2026-01-31 02:20:53 +00:00
Change Bitcoin to Dogecoin in qa/ files
This changes all occurrences of `BITCOIN` to `DOGECOIN` and `bitcoind` to `dogecoind` in all files in `qa/`. It does not change copyright information.
This commit is contained in:
parent
5bbb1fa1d8
commit
1cabf8dfb1
@ -54,9 +54,9 @@ Possible options, which apply to each individual test run:
|
||||
|
||||
```
|
||||
-h, --help show this help message and exit
|
||||
--nocleanup Leave bitcoinds and test.* datadir on exit or error
|
||||
--noshutdown Don't stop bitcoinds after the test execution
|
||||
--srcdir=SRCDIR Source directory containing bitcoind/bitcoin-cli
|
||||
--nocleanup Leave dogecoinds and test.* datadir on exit or error
|
||||
--noshutdown Don't stop dogecoinds after the test execution
|
||||
--srcdir=SRCDIR Source directory containing dogecoind/dogecoin-cli
|
||||
(default: ../../src)
|
||||
--tmpdir=TMPDIR Root directory for datadirs
|
||||
--tracerpc Print out all RPC calls as they are made
|
||||
|
||||
@ -44,8 +44,8 @@ RPC_TESTS_DIR = SRCDIR + '/qa/rpc-tests/'
|
||||
#If imported values are not defined then set to zero (or disabled)
|
||||
if 'ENABLE_WALLET' not in vars():
|
||||
ENABLE_WALLET=0
|
||||
if 'ENABLE_BITCOIND' not in vars():
|
||||
ENABLE_BITCOIND=0
|
||||
if 'ENABLE_DOGECOIND' not in vars():
|
||||
ENABLE_DOGECOIND=0
|
||||
if 'ENABLE_UTILS' not in vars():
|
||||
ENABLE_UTILS=0
|
||||
if 'ENABLE_ZMQ' not in vars():
|
||||
@ -76,8 +76,8 @@ for arg in sys.argv[1:]:
|
||||
opts.add(arg)
|
||||
|
||||
#Set env vars
|
||||
if "BITCOIND" not in os.environ:
|
||||
os.environ["BITCOIND"] = BUILDDIR + '/src/bitcoind' + EXEEXT
|
||||
if "DOGECOIND" not in os.environ:
|
||||
os.environ["DOGECOIND"] = BUILDDIR + '/src/dogecoind' + EXEEXT
|
||||
|
||||
if EXEEXT == ".exe" and "-win" not in opts:
|
||||
# https://github.com/bitcoin/bitcoin/commit/d52802551752140cf41f0d9a225a43e84404d3e9
|
||||
@ -85,8 +85,8 @@ if EXEEXT == ".exe" and "-win" not in opts:
|
||||
print("Win tests currently disabled by default. Use -win option to enable")
|
||||
sys.exit(0)
|
||||
|
||||
if not (ENABLE_WALLET == 1 and ENABLE_UTILS == 1 and ENABLE_BITCOIND == 1):
|
||||
print("No rpc tests to run. Wallet, utils, and bitcoind must all be enabled")
|
||||
if not (ENABLE_WALLET == 1 and ENABLE_UTILS == 1 and ENABLE_DOGECOIND == 1):
|
||||
print("No rpc tests to run. Wallet, utils, and dogecoind must all be enabled")
|
||||
sys.exit(0)
|
||||
|
||||
# python3-zmq may not be installed. Handle this gracefully and with some helpful info
|
||||
@ -288,7 +288,7 @@ class RPCTestHandler:
|
||||
self.test_list = test_list
|
||||
self.flags = flags
|
||||
self.num_running = 0
|
||||
# In case there is a graveyard of zombie bitcoinds, we can apply a
|
||||
# In case there is a graveyard of zombie dogecoinds, we can apply a
|
||||
# pseudorandom offset to hopefully jump over them.
|
||||
# (625 is PORT_RANGE/MAX_NODES)
|
||||
self.portseed_offset = int(time.time() * 1000) % 625
|
||||
@ -335,7 +335,7 @@ class RPCCoverage(object):
|
||||
Coverage calculation works by having each test script subprocess write
|
||||
coverage files into a particular directory. These files contain the RPC
|
||||
commands invoked during testing, as well as a complete listing of RPC
|
||||
commands per `bitcoin-cli help` (`rpc_interface.txt`).
|
||||
commands per `dogecoin-cli help` (`rpc_interface.txt`).
|
||||
|
||||
After all tests complete, the commands run are combined and diff'd against
|
||||
the complete list to calculate uncovered RPC commands.
|
||||
|
||||
@ -10,5 +10,5 @@ EXEEXT="@EXEEXT@"
|
||||
# These will turn into comments if they were disabled when configuring.
|
||||
@ENABLE_WALLET_TRUE@ENABLE_WALLET=1
|
||||
@BUILD_BITCOIN_UTILS_TRUE@ENABLE_UTILS=1
|
||||
@BUILD_BITCOIND_TRUE@ENABLE_BITCOIND=1
|
||||
@BUILD_BITCOIND_TRUE@ENABLE_DOGECOIND=1
|
||||
@ENABLE_ZMQ_TRUE@ENABLE_ZMQ=1
|
||||
|
||||
@ -11,7 +11,7 @@ Base class for new regression tests.
|
||||
Generally useful functions.
|
||||
|
||||
### [test_framework/mininode.py](test_framework/mininode.py)
|
||||
Basic code to support p2p connectivity to a bitcoind.
|
||||
Basic code to support p2p connectivity to a dogecoind.
|
||||
|
||||
### [test_framework/comptool.py](test_framework/comptool.py)
|
||||
Framework for comparison-tool style, p2p tests.
|
||||
@ -41,10 +41,10 @@ over the network (```CBlock```, ```CTransaction```, etc, along with the network-
|
||||
wrappers for them, ```msg_block```, ```msg_tx```, etc).
|
||||
|
||||
* P2P tests have two threads. One thread handles all network communication
|
||||
with the bitcoind(s) being tested (using python's asyncore package); the other
|
||||
with the dogecoind(s) being tested (using python's asyncore package); the other
|
||||
implements the test logic.
|
||||
|
||||
* ```NodeConn``` is the class used to connect to a bitcoind. If you implement
|
||||
* ```NodeConn``` is the class used to connect to a dogecoind. If you implement
|
||||
a callback class that derives from ```NodeConnCB``` and pass that to the
|
||||
```NodeConn``` object, your code will receive the appropriate callbacks when
|
||||
events of interest arrive.
|
||||
@ -64,13 +64,13 @@ is tested. Examples: ```p2p-accept-block.py```, ```maxblocksinflight.py```.
|
||||
## Comptool
|
||||
|
||||
* Testing framework for writing tests that compare the block/tx acceptance
|
||||
behavior of a bitcoind against 1 or more other bitcoind instances, or against
|
||||
behavior of a dogecoind against 1 or more other dogecoind instances, or against
|
||||
known outcomes, or both.
|
||||
|
||||
* Set the ```num_nodes``` variable (defined in ```ComparisonTestFramework```) to start up
|
||||
1 or more nodes. If using 1 node, then ```--testbinary``` can be used as a command line
|
||||
option to change the bitcoind binary used by the test. If using 2 or more nodes,
|
||||
then ```--refbinary``` can be optionally used to change the bitcoind that will be used
|
||||
option to change the dogecoind binary used by the test. If using 2 or more nodes,
|
||||
then ```--refbinary``` can be optionally used to change the dogecoind that will be used
|
||||
on nodes 2 and up.
|
||||
|
||||
* Implement a (generator) function called ```get_tests()``` which yields ```TestInstance```s.
|
||||
@ -79,13 +79,13 @@ Each ```TestInstance``` consists of:
|
||||
* ```object``` is a ```CBlock```, ```CTransaction```, or
|
||||
```CBlockHeader```. ```CBlock```'s and ```CTransaction```'s are tested for
|
||||
acceptance. ```CBlockHeader```s can be used so that the test runner can deliver
|
||||
complete headers-chains when requested from the bitcoind, to allow writing
|
||||
complete headers-chains when requested from the dogecoind, to allow writing
|
||||
tests where blocks can be delivered out of order but still processed by
|
||||
headers-first bitcoind's.
|
||||
headers-first dogecoind's.
|
||||
* ```outcome``` is ```True```, ```False```, or ```None```. If ```True```
|
||||
or ```False```, the tip is compared with the expected tip -- either the
|
||||
block passed in, or the hash specified as the optional 3rd entry. If
|
||||
```None``` is specified, then the test will compare all the bitcoind's
|
||||
```None``` is specified, then the test will compare all the dogecoind's
|
||||
being tested to see if they all agree on what the best tip is.
|
||||
* ```hash``` is the block hash of the tip to compare against. Optional to
|
||||
specify; if left out then the hash of the block passed in will be used as
|
||||
@ -99,7 +99,7 @@ Each ```TestInstance``` consists of:
|
||||
sequence and synced (this is slower when processing many blocks).
|
||||
- ```sync_every_transaction```: ```True/False```. Analogous to
|
||||
```sync_every_block```, except if the outcome on the last tx is "None",
|
||||
then the contents of the entire mempool are compared across all bitcoind
|
||||
then the contents of the entire mempool are compared across all dogecoind
|
||||
connections. If ```True``` or ```False```, then only the last tx's
|
||||
acceptance is tested against the given outcome.
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ class BumpFeeTest(BitcoinTestFramework):
|
||||
|
||||
# Encrypt wallet for test_locked_wallet_fails test
|
||||
self.nodes[1].encryptwallet(WALLET_PASSPHRASE)
|
||||
bitcoind_processes[1].wait()
|
||||
dogecoind_processes[1].wait()
|
||||
self.nodes[1] = start_node(1, self.options.tmpdir, extra_args[1])
|
||||
self.nodes[1].walletpassphrase(WALLET_PASSPHRASE, WALLET_PASSPHRASE_TIMEOUT)
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ class HTTPBasicsTest (BitcoinTestFramework):
|
||||
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
|
||||
out1 = conn.getresponse().read()
|
||||
assert(b'"error":null' in out1)
|
||||
assert(conn.sock!=None) #connection must be closed because bitcoind should use keep-alive by default
|
||||
assert(conn.sock!=None) #connection must be closed because dogecoind should use keep-alive by default
|
||||
|
||||
# Check excessive request size
|
||||
conn = http.client.HTTPConnection(urlNode2.hostname, urlNode2.port)
|
||||
|
||||
@ -19,7 +19,7 @@ class KeyPoolTest(BitcoinTestFramework):
|
||||
|
||||
# Encrypt wallet and wait to terminate
|
||||
nodes[0].encryptwallet('test')
|
||||
bitcoind_processes[0].wait()
|
||||
dogecoind_processes[0].wait()
|
||||
# Restart node 0
|
||||
nodes[0] = start_node(0, self.options.tmpdir)
|
||||
# Keep creating keys
|
||||
|
||||
@ -24,7 +24,7 @@ class HTTPBasicsTest (BitcoinTestFramework):
|
||||
|
||||
def setup_chain(self):
|
||||
super().setup_chain()
|
||||
#Append rpcauth to bitcoin.conf before initialization
|
||||
#Append rpcauth to dogecoin.conf before initialization
|
||||
rpcauth = "rpcauth=rt:93648e835a54c573682c2eb19f882535$7681e9c5b74bdd85e78166031d2058e1069b3ed7ed967c93fc63abba06f31144"
|
||||
rpcauth2 = "rpcauth=rt2:f8607b1a88861fac29dfccf9b52ff9f$ff36a0c23c8c62b4846112e50fa888416e94c17bfd4c42f88fd8f55ec6a3137e"
|
||||
with open(os.path.join(self.options.tmpdir+"/node0", "dogecoin.conf"), 'a', encoding='utf8') as f:
|
||||
|
||||
@ -17,7 +17,7 @@ Version 1 compact blocks are pre-segwit (txids)
|
||||
Version 2 compact blocks are post-segwit (wtxids)
|
||||
'''
|
||||
|
||||
# TestNode: A peer we use to send messages to bitcoind, and store responses.
|
||||
# TestNode: A peer we use to send messages to dogecoind, and store responses.
|
||||
class TestNode(SingleNodeConnCB):
|
||||
def __init__(self):
|
||||
SingleNodeConnCB.__init__(self)
|
||||
@ -266,7 +266,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
old_node.request_headers_and_sync(locator=[tip])
|
||||
check_announcement_of_new_block(node, old_node, lambda p: p.last_cmpctblock is not None)
|
||||
|
||||
# This test actually causes bitcoind to (reasonably!) disconnect us, so do this last.
|
||||
# This test actually causes dogecoind to (reasonably!) disconnect us, so do this last.
|
||||
def test_invalid_cmpctblock_message(self):
|
||||
self.nodes[0].generate(101)
|
||||
block = self.build_block_on_tip(self.nodes[0])
|
||||
@ -281,7 +281,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
assert(int(self.nodes[0].getbestblockhash(), 16) == block.hashPrevBlock)
|
||||
|
||||
# Compare the generated shortids to what we expect based on BIP 152, given
|
||||
# bitcoind's choice of nonce.
|
||||
# dogecoind's choice of nonce.
|
||||
def test_compactblock_construction(self, node, test_node, version, use_witness_address):
|
||||
# Generate a bunch of transactions.
|
||||
node.generate(101)
|
||||
@ -396,7 +396,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
header_and_shortids.shortids.pop(0)
|
||||
index += 1
|
||||
|
||||
# Test that bitcoind requests compact blocks when we announce new blocks
|
||||
# Test that dogecoind requests compact blocks when we announce new blocks
|
||||
# via header or inv, and that responding to getblocktxn causes the block
|
||||
# to be successfully reconstructed.
|
||||
# Post-segwit: upgraded nodes would only make this request of cb-version-2,
|
||||
@ -580,7 +580,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
assert_equal(absolute_indexes, [6, 7, 8, 9, 10])
|
||||
|
||||
# Now give an incorrect response.
|
||||
# Note that it's possible for bitcoind to be smart enough to know we're
|
||||
# Note that it's possible for dogecoind to be smart enough to know we're
|
||||
# lying, since it could check to see if the shortid matches what we're
|
||||
# sending, and eg disconnect us for misbehavior. If that behavior
|
||||
# change were made, we could just modify this test by having a
|
||||
@ -611,7 +611,7 @@ class CompactBlocksTest(BitcoinTestFramework):
|
||||
assert_equal(int(node.getbestblockhash(), 16), block.sha256)
|
||||
|
||||
def test_getblocktxn_handler(self, node, test_node, version):
|
||||
# bitcoind will not send blocktxn responses for blocks whose height is
|
||||
# dogecoind will not send blocktxn responses for blocks whose height is
|
||||
# more than 10 blocks deep.
|
||||
MAX_GETBLOCKTXN_DEPTH = 10
|
||||
chain_height = node.getblockcount()
|
||||
|
||||
@ -397,7 +397,7 @@ class FullBlockTest(ComparisonTestFramework):
|
||||
b26 = update_block(26, [])
|
||||
yield rejected(RejectResult(16, b'bad-cb-length'))
|
||||
|
||||
# Extend the b26 chain to make sure bitcoind isn't accepting b26
|
||||
# Extend the b26 chain to make sure dogecoind isn't accepting b26
|
||||
b27 = block(27, spend=out[7])
|
||||
yield rejected(RejectResult(0, b'bad-prevblk'))
|
||||
|
||||
@ -409,7 +409,7 @@ class FullBlockTest(ComparisonTestFramework):
|
||||
b28 = update_block(28, [])
|
||||
yield rejected(RejectResult(16, b'bad-cb-length'))
|
||||
|
||||
# Extend the b28 chain to make sure bitcoind isn't accepting b28
|
||||
# Extend the b28 chain to make sure dogecoind isn't accepting b28
|
||||
b29 = block(29, spend=out[7])
|
||||
yield rejected(RejectResult(0, b'bad-prevblk'))
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ class CNodeNoVersionBan(CLazyNode):
|
||||
super().__init__()
|
||||
|
||||
# send a bunch of veracks without sending a message. This should get us disconnected.
|
||||
# NOTE: implementation-specific check here. Remove if bitcoind ban behavior changes
|
||||
# NOTE: implementation-specific check here. Remove if dogecoind ban behavior changes
|
||||
def on_open(self, conn):
|
||||
super().on_open(conn)
|
||||
for i in range(banscore):
|
||||
|
||||
@ -288,7 +288,7 @@ class SegWitTest(BitcoinTestFramework):
|
||||
# rule).
|
||||
self.test_node.test_witness_block(block, accepted=False)
|
||||
# TODO: fix synchronization so we can test reject reason
|
||||
# Right now, bitcoind delays sending reject messages for blocks
|
||||
# Right now, dogecoind delays sending reject messages for blocks
|
||||
# until the future, making synchronization here difficult.
|
||||
#assert_equal(self.test_node.last_reject.reason, "unexpected-witness")
|
||||
|
||||
@ -612,7 +612,7 @@ class SegWitTest(BitcoinTestFramework):
|
||||
self.nodes[0].submitblock(bytes_to_hex_str(block.serialize(True)))
|
||||
assert(self.nodes[0].getbestblockhash() != block.hash)
|
||||
|
||||
# Now redo commitment with the standard nonce, but let bitcoind fill it in.
|
||||
# Now redo commitment with the standard nonce, but let dogecoind fill it in.
|
||||
add_witness_commitment(block, nonce=0)
|
||||
block.vtx[0].wit = CTxWitness()
|
||||
block.solve()
|
||||
@ -1527,7 +1527,7 @@ class SegWitTest(BitcoinTestFramework):
|
||||
# This transaction should not be accepted into the mempool pre- or
|
||||
# post-segwit. Mempool acceptance will use SCRIPT_VERIFY_WITNESS which
|
||||
# will require a witness to spend a witness program regardless of
|
||||
# segwit activation. Note that older bitcoind's that are not
|
||||
# segwit activation. Note that older dogecoind's that are not
|
||||
# segwit-aware would also reject this for failing CLEANSTACK.
|
||||
self.test_node.test_transaction_acceptance(spend_tx, with_witness=False, accepted=False)
|
||||
|
||||
@ -1563,12 +1563,12 @@ class SegWitTest(BitcoinTestFramework):
|
||||
# Test the behavior of starting up a segwit-aware node after the softfork
|
||||
# has activated. As segwit requires different block data than pre-segwit
|
||||
# nodes would have stored, this requires special handling.
|
||||
# To enable this test, pass --oldbinary=<path-to-pre-segwit-bitcoind> to
|
||||
# To enable this test, pass --oldbinary=<path-to-pre-segwit-dogecoind> to
|
||||
# the test.
|
||||
def test_upgrade_after_activation(self, node, node_id):
|
||||
print("\tTesting software upgrade after softfork activation")
|
||||
|
||||
assert(node_id != 0) # node0 is assumed to be a segwit-active bitcoind
|
||||
assert(node_id != 0) # node0 is assumed to be a segwit-active dogecoind
|
||||
|
||||
# Make sure the nodes are all up
|
||||
sync_blocks(self.nodes)
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
""" TimeoutsTest -- test various net timeouts (only in extended tests)
|
||||
|
||||
- Create three bitcoind nodes:
|
||||
- Create three dogecoind nodes:
|
||||
|
||||
no_verack_node - we never send a verack in response to their version
|
||||
no_version_node - we never send a version (only a ping)
|
||||
|
||||
@ -17,10 +17,10 @@ from test_framework.util import (
|
||||
from test_framework.netutil import test_ipv6_local
|
||||
'''
|
||||
Test plan:
|
||||
- Start bitcoind's with different proxy configurations
|
||||
- Start dogecoind with different proxy configurations
|
||||
- Use addnode to initiate connections
|
||||
- Verify that proxies are connected to, and the right connection command is given
|
||||
- Proxy configurations to test on bitcoind side:
|
||||
- Proxy configurations to test on dogecoind side:
|
||||
- `-proxy` (proxy everything)
|
||||
- `-onion` (proxy just onions)
|
||||
- `-proxyrandomize` Circuit randomization
|
||||
@ -30,8 +30,8 @@ Test plan:
|
||||
- proxy on IPv6
|
||||
|
||||
- Create various proxies (as threads)
|
||||
- Create bitcoinds that connect to them
|
||||
- Manipulate the bitcoinds using addnode (onetry) an observe effects
|
||||
- Create dogecoinds that connect to them
|
||||
- Manipulate the dogecoinds using addnode (onetry) an observe effects
|
||||
|
||||
addnode connect to IPv4
|
||||
addnode connect to IPv6
|
||||
@ -97,7 +97,7 @@ class ProxyTest(BitcoinTestFramework):
|
||||
node.addnode("15.61.23.23:1234", "onetry")
|
||||
cmd = proxies[0].queue.get()
|
||||
assert(isinstance(cmd, Socks5Command))
|
||||
# Note: bitcoind's SOCKS5 implementation only sends atyp DOMAINNAME, even if connecting directly to IPv4/IPv6
|
||||
# Note: dogecoind's SOCKS5 implementation only sends atyp DOMAINNAME, even if connecting directly to IPv4/IPv6
|
||||
assert_equal(cmd.atyp, AddressType.DOMAINNAME)
|
||||
assert_equal(cmd.addr, b"15.61.23.23")
|
||||
assert_equal(cmd.port, 1234)
|
||||
@ -111,7 +111,7 @@ class ProxyTest(BitcoinTestFramework):
|
||||
node.addnode("[1233:3432:2434:2343:3234:2345:6546:4534]:5443", "onetry")
|
||||
cmd = proxies[1].queue.get()
|
||||
assert(isinstance(cmd, Socks5Command))
|
||||
# Note: bitcoind's SOCKS5 implementation only sends atyp DOMAINNAME, even if connecting directly to IPv4/IPv6
|
||||
# Note: dogecoind's SOCKS5 implementation only sends atyp DOMAINNAME, even if connecting directly to IPv4/IPv6
|
||||
assert_equal(cmd.atyp, AddressType.DOMAINNAME)
|
||||
assert_equal(cmd.addr, b"1233:3432:2434:2343:3234:2345:6546:4534")
|
||||
assert_equal(cmd.port, 5443)
|
||||
|
||||
@ -35,7 +35,7 @@ class RPCBindTest(BitcoinTestFramework):
|
||||
base_args += ['-rpcallowip=' + x for x in allow_ips]
|
||||
binds = ['-rpcbind='+addr for addr in addresses]
|
||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, [base_args + binds], connect_to)
|
||||
pid = bitcoind_processes[0].pid
|
||||
pid = dogecoind_processes[0].pid
|
||||
assert_equal(set(get_bind_addrs(pid)), set(expected))
|
||||
stop_nodes(self.nodes)
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ from .blockstore import BlockStore, TxStore
|
||||
from .util import p2p_port
|
||||
|
||||
'''
|
||||
This is a tool for comparing two or more bitcoinds to each other
|
||||
This is a tool for comparing two or more dogecoinds to each other
|
||||
using a script provided.
|
||||
|
||||
To use, create a class that implements get_tests(), and pass it in
|
||||
|
||||
@ -73,7 +73,7 @@ def get_filename(dirname, n_node):
|
||||
|
||||
def write_all_rpc_commands(dirname, node):
|
||||
"""
|
||||
Write out a list of all RPC functions available in `bitcoin-cli` for
|
||||
Write out a list of all RPC functions available in `dogecoin-cli` for
|
||||
coverage comparison. This will only happen once per coverage
|
||||
directory.
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
# This python code was modified from ArtForz' public domain half-a-node, as
|
||||
# found in the mini-node branch of http://github.com/jgarzik/pynode.
|
||||
#
|
||||
# NodeConn: an object which manages p2p connectivity to a bitcoin node
|
||||
# NodeConn: an object which manages p2p connectivity to a dogecoin node
|
||||
# NodeConnCB: a base class that describes the interface for receiving
|
||||
# callbacks with network messages from a NodeConn
|
||||
# CBlock, CTransaction, CBlockHeader, CTxIn, CTxOut, etc....:
|
||||
@ -214,7 +214,7 @@ def FromHex(obj, hex_string):
|
||||
def ToHex(obj):
|
||||
return bytes_to_hex_str(obj.serialize())
|
||||
|
||||
# Objects that map to bitcoind objects, which can be serialized/deserialized
|
||||
# Objects that map to dogecoind objects, which can be serialized/deserialized
|
||||
|
||||
class CAddress(object):
|
||||
def __init__(self):
|
||||
@ -452,7 +452,7 @@ class CTransaction(object):
|
||||
if len(self.vin) == 0:
|
||||
flags = struct.unpack("<B", f.read(1))[0]
|
||||
# Not sure why flags can't be zero, but this
|
||||
# matches the implementation in bitcoind
|
||||
# matches the implementation in dogecoind
|
||||
if (flags != 0):
|
||||
self.vin = deser_vector(f, CTxIn)
|
||||
self.vout = deser_vector(f, CTxOut)
|
||||
@ -1335,7 +1335,7 @@ class msg_headers(object):
|
||||
self.headers = []
|
||||
|
||||
def deserialize(self, f):
|
||||
# comment in bitcoind indicates these should be deserialized as blocks
|
||||
# comment in dogecoind indicates these should be deserialized as blocks
|
||||
blocks = deser_vector(f, CBlock)
|
||||
for x in blocks:
|
||||
self.headers.append(CBlockHeader(x))
|
||||
|
||||
@ -191,7 +191,7 @@ class BitcoinTestFramework(object):
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
# Test framework for doing p2p comparison testing, which sets up some bitcoind
|
||||
# Test framework for doing p2p comparison testing, which sets up some dogecoind
|
||||
# binaries:
|
||||
# 1 binary: test binary
|
||||
# 2 binaries: 1 test binary, 1 ref binary
|
||||
|
||||
@ -37,7 +37,7 @@ PORT_MIN = 11000
|
||||
# The number of ports to "reserve" for p2p and rpc, each
|
||||
PORT_RANGE = 5000
|
||||
|
||||
BITCOIND_PROC_WAIT_TIMEOUT = 60
|
||||
DOGECOIND_PROC_WAIT_TIMEOUT = 60
|
||||
|
||||
|
||||
class PortSeed:
|
||||
@ -177,7 +177,7 @@ def sync_mempools(rpc_connections, *, wait=1, timeout=60):
|
||||
timeout -= wait
|
||||
raise AssertionError("Mempool sync failed")
|
||||
|
||||
bitcoind_processes = {}
|
||||
dogecoind_processes = {}
|
||||
|
||||
def initialize_datadir(dirname, n):
|
||||
datadir = os.path.join(dirname, "node"+str(n))
|
||||
@ -208,10 +208,10 @@ def rpc_url(i, rpchost=None):
|
||||
host = rpchost
|
||||
return "http://%s:%s@%s:%d" % (rpc_u, rpc_p, host, int(port))
|
||||
|
||||
def wait_for_bitcoind_start(process, url, i):
|
||||
def wait_for_dogecoind_start(process, url, i):
|
||||
'''
|
||||
Wait for bitcoind to start. This means that RPC is accessible and fully initialized.
|
||||
Raise an exception if bitcoind exits during initialization.
|
||||
Wait for dogecoind to start. This means that RPC is accessible and fully initialized.
|
||||
Raise an exception if dogecoind exits during initialization.
|
||||
'''
|
||||
while True:
|
||||
if process.poll() is not None:
|
||||
@ -248,16 +248,16 @@ def initialize_chain(test_dir, num_nodes, cachedir):
|
||||
if os.path.isdir(os.path.join(cachedir,"node"+str(i))):
|
||||
shutil.rmtree(os.path.join(cachedir,"node"+str(i)))
|
||||
|
||||
# Create cache directories, run bitcoinds:
|
||||
# Create cache directories, run dogecoinds:
|
||||
for i in range(MAX_NODES):
|
||||
datadir=initialize_datadir(cachedir, i)
|
||||
args = [ os.getenv("DOGECOIND", "dogecoind"), "-server", "-keypool=1", "-datadir="+datadir, "-discover=0" ]
|
||||
if i > 0:
|
||||
args.append("-connect=127.0.0.1:"+str(p2p_port(0)))
|
||||
bitcoind_processes[i] = subprocess.Popen(args)
|
||||
dogecoind_processes[i] = subprocess.Popen(args)
|
||||
if os.getenv("PYTHON_DEBUG", ""):
|
||||
print("initialize_chain: dogecoind started, waiting for RPC to come up")
|
||||
wait_for_bitcoind_start(bitcoind_processes[i], rpc_url(i), i)
|
||||
wait_for_dogecoind_start(dogecoind_processes[i], rpc_url(i), i)
|
||||
if os.getenv("PYTHON_DEBUG", ""):
|
||||
print("initialize_chain: RPC successfully started")
|
||||
|
||||
@ -300,7 +300,7 @@ def initialize_chain(test_dir, num_nodes, cachedir):
|
||||
from_dir = os.path.join(cachedir, "node"+str(i))
|
||||
to_dir = os.path.join(test_dir, "node"+str(i))
|
||||
shutil.copytree(from_dir, to_dir)
|
||||
initialize_datadir(test_dir, i) # Overwrite port/rpcport in bitcoin.conf
|
||||
initialize_datadir(test_dir, i) # Overwrite port/rpcport in dogecoin.conf
|
||||
|
||||
def initialize_chain_clean(test_dir, num_nodes):
|
||||
"""
|
||||
@ -333,18 +333,18 @@ def _rpchost_to_args(rpchost):
|
||||
|
||||
def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary=None):
|
||||
"""
|
||||
Start a bitcoind and return RPC connection to it
|
||||
Start a dogecoind and return RPC connection to it
|
||||
"""
|
||||
datadir = os.path.join(dirname, "node"+str(i))
|
||||
if binary is None:
|
||||
binary = os.getenv("DOGECOIND", "dogecoind")
|
||||
args = [ binary, "-datadir="+datadir, "-server", "-keypool=1", "-discover=0", "-rest", "-mocktime="+str(get_mocktime()) ]
|
||||
if extra_args is not None: args.extend(extra_args)
|
||||
bitcoind_processes[i] = subprocess.Popen(args)
|
||||
dogecoind_processes[i] = subprocess.Popen(args)
|
||||
if os.getenv("PYTHON_DEBUG", ""):
|
||||
print("start_node: dogecoind started, waiting for RPC to come up")
|
||||
url = rpc_url(i, rpchost)
|
||||
wait_for_bitcoind_start(bitcoind_processes[i], url, i)
|
||||
wait_for_dogecoind_start(dogecoind_processes[i], url, i)
|
||||
if os.getenv("PYTHON_DEBUG", ""):
|
||||
print("start_node: RPC successfully started")
|
||||
proxy = get_rpc_proxy(url, i, timeout=timewait)
|
||||
@ -356,7 +356,7 @@ def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary=
|
||||
|
||||
def start_nodes(num_nodes, dirname, extra_args=None, rpchost=None, timewait=None, binary=None):
|
||||
"""
|
||||
Start multiple bitcoinds, return RPC connections to them
|
||||
Start multiple dogecoinds, return RPC connections to them
|
||||
"""
|
||||
if extra_args is None: extra_args = [ None for _ in range(num_nodes) ]
|
||||
if binary is None: binary = [ None for _ in range(num_nodes) ]
|
||||
@ -377,14 +377,14 @@ def stop_node(node, i):
|
||||
node.stop()
|
||||
except http.client.CannotSendRequest as e:
|
||||
print("WARN: Unable to stop node: " + repr(e))
|
||||
return_code = bitcoind_processes[i].wait(timeout=BITCOIND_PROC_WAIT_TIMEOUT)
|
||||
return_code = dogecoind_processes[i].wait(timeout=DOGECOIND_PROC_WAIT_TIMEOUT)
|
||||
assert_equal(return_code, 0)
|
||||
del bitcoind_processes[i]
|
||||
del dogecoind_processes[i]
|
||||
|
||||
def stop_nodes(nodes):
|
||||
for i, node in enumerate(nodes):
|
||||
stop_node(node, i)
|
||||
assert not bitcoind_processes.values() # All connections must be gone now
|
||||
assert not dogecoind_processes.values() # All connections must be gone now
|
||||
|
||||
def set_node_times(nodes, t):
|
||||
for node in nodes:
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import (start_nodes, start_node, assert_equal, bitcoind_processes, JSONRPCException)
|
||||
from test_framework.util import (start_nodes, start_node, assert_equal, dogecoind_processes, JSONRPCException)
|
||||
|
||||
|
||||
def read_dump(file_name, addrs, hd_master_addr_old):
|
||||
@ -95,7 +95,7 @@ class WalletDumpTest(BitcoinTestFramework):
|
||||
|
||||
#encrypt wallet, restart, unlock and dump
|
||||
self.nodes[0].encryptwallet('test')
|
||||
bitcoind_processes[0].wait()
|
||||
dogecoind_processes[0].wait()
|
||||
self.nodes[0] = start_node(0, self.options.tmpdir, self.extra_args[0])
|
||||
self.nodes[0].walletpassphrase('test', 10)
|
||||
# Should be a no-op:
|
||||
|
||||
@ -154,7 +154,7 @@ class WalletNotifyTest(BitcoinTestFramework):
|
||||
|
||||
# stop, remove the mempool, zap the wallet, and start again
|
||||
self.nodes[2].stop()
|
||||
bitcoind_processes[2].wait()
|
||||
dogecoind_processes[2].wait()
|
||||
os.remove(log_filename(self.options.tmpdir, 2, "mempool.dat"))
|
||||
self.nodes[2] = start_node(2, self.options.tmpdir,["-debug", "-acceptnonstdtxn=0", "-minrelaytxfee=1", "-zapwallettxes"])
|
||||
|
||||
|
||||
@ -53,18 +53,18 @@ class ZapWalletTXesTest (BitcoinTestFramework):
|
||||
tx3 = self.nodes[0].gettransaction(txid3)
|
||||
assert_equal(tx3['txid'], txid3) #tx3 must be available (unconfirmed)
|
||||
|
||||
#restart bitcoind
|
||||
#restart dogecoind
|
||||
self.nodes[0].stop()
|
||||
bitcoind_processes[0].wait()
|
||||
dogecoind_processes[0].wait()
|
||||
self.nodes[0] = start_node(0,self.options.tmpdir)
|
||||
|
||||
tx3 = self.nodes[0].gettransaction(txid3)
|
||||
assert_equal(tx3['txid'], txid3) #tx must be available (unconfirmed)
|
||||
|
||||
self.nodes[0].stop()
|
||||
bitcoind_processes[0].wait()
|
||||
dogecoind_processes[0].wait()
|
||||
|
||||
#restart bitcoind with zapwallettxes
|
||||
#restart dogecoind with zapwallettxes
|
||||
self.nodes[0] = start_node(0,self.options.tmpdir, ["-zapwallettxes=1"])
|
||||
|
||||
assert_raises(JSONRPCException, self.nodes[0].gettransaction, [txid3])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user