Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rpc-tests #720

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion qa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ output (example: `PYTHON_DEBUG=1 qa/pull-tester/rpc-tests.py wallet`).
A 200-block -regtest blockchain and wallets for four nodes
is created the first time a regression test is run and
is stored in the cache/ directory. Each node has 25 mature
blocks (25*50=1250 BTC) in its wallet.
blocks (25*500=12500 DASH) in its wallet.

After the first run, the cache/ blockchain and wallets are
copied into a temporary directory and used as the initial
Expand Down
20 changes: 10 additions & 10 deletions qa/pull-tester/rpc-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,35 +97,35 @@
'nodehandling.py',
'reindex.py',
'decodescript.py',
'p2p-fullblocktest.py',
'p2p-fullblocktest.py', # TODO: works, needs dash_hash
'blockchain.py',
'disablewallet.py',
'sendheaders.py',
'sendheaders.py', # TODO: works, needs dash_hash
'keypool.py',
'prioritise_transaction.py',
'invalidblockrequest.py',
'invalidtxrequest.py',
'invalidblockrequest.py', # TODO: works, needs dash_hash
'invalidtxrequest.py', # TODO: works, needs dash_hash
'abandonconflict.py',
]
testScriptsExt = [
'bip65-cltv.py',
'bip65-cltv-p2p.py',
'bipdersig-p2p.py',
'bip65-cltv-p2p.py', # TODO: works, needs dash_hash
'bipdersig-p2p.py', # TODO: works, needs dash_hash
'bipdersig.py',
'getblocktemplate_longpoll.py',
'getblocktemplate_longpoll.py', # FIXME: "socket.error: [Errno 54] Connection reset by peer" on my Mac, same as https://github.com/bitcoin/bitcoin/issues/6651
'getblocktemplate_proposals.py',
'txn_doublespend.py',
'txn_clone.py --mineblock',
'pruning.py',
# 'pruning.py', # Prune mode is incompatible with -txindex.
'forknotify.py',
'invalidateblock.py',
# 'rpcbind_test.py', #temporary, bug in libevent, see #6655
'smartfees.py',
'maxblocksinflight.py',
'p2p-acceptblock.py',
'p2p-acceptblock.py', # TODO: works, needs dash_hash
'mempool_packages.py',
'maxuploadtarget.py',
'replace-by-fee.py',
# 'replace-by-fee.py', # RBF is disabled in Dash
]

#Enable ZMQ tests
Expand Down
4 changes: 2 additions & 2 deletions qa/rpc-tests/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ def _test_gettxoutsetinfo(self):
node = self.nodes[0]
res = node.gettxoutsetinfo()

assert_equal(res[u'total_amount'], Decimal('8725.00000000'))
assert_equal(res[u'total_amount'], Decimal('98214.28571450'))
assert_equal(res[u'transactions'], 200)
assert_equal(res[u'height'], 200)
assert_equal(res[u'txouts'], 200)
assert_equal(res[u'bytes_serialized'], 13924),
assert_equal(res[u'bytes_serialized'], 14273),
assert_equal(len(res[u'bestblock']), 64)
assert_equal(len(res[u'hash_serialized']), 64)

Expand Down
4 changes: 2 additions & 2 deletions qa/rpc-tests/disablewallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def setup_network(self, split=False):

def run_test (self):
# Check regression: https://github.com/bitcoin/bitcoin/issues/6963#issuecomment-154548880
x = self.nodes[0].validateaddress('3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy')
x = self.nodes[0].validateaddress('7TSBtVu959hGEGPKyHjJz9k55RpWrPffXz')
assert(x['isvalid'] == False)
x = self.nodes[0].validateaddress('mneYUmWYsuk7kySiURxCi3AGxrAqZxLgPZ')
x = self.nodes[0].validateaddress('xwJHtLhWeRzaDXrQqYuDaF1NrwYbgMWYDS')
assert(x['isvalid'] == True)

if __name__ == '__main__':
Expand Down
72 changes: 36 additions & 36 deletions qa/rpc-tests/fundrawtransaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ def run_test(self):

watchonly_address = self.nodes[0].getnewaddress()
watchonly_pubkey = self.nodes[0].validateaddress(watchonly_address)["pubkey"]
watchonly_amount = 200
watchonly_amount = 2000
self.nodes[3].importpubkey(watchonly_pubkey, "", True)
watchonly_txid = self.nodes[0].sendtoaddress(watchonly_address, watchonly_amount)
self.nodes[0].sendtoaddress(self.nodes[3].getnewaddress(), watchonly_amount / 10)

self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1.5)
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1.0)
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 5.0)
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 15)
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 10)
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 50)

self.sync_all()
self.nodes[0].generate(1)
Expand All @@ -65,7 +65,7 @@ def run_test(self):
# simple test #
###############
inputs = [ ]
outputs = { self.nodes[0].getnewaddress() : 1.0 }
outputs = { self.nodes[0].getnewaddress() : 10 }
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
rawtxfund = self.nodes[2].fundrawtransaction(rawtx)
Expand All @@ -77,7 +77,7 @@ def run_test(self):
# simple test with two coins #
##############################
inputs = [ ]
outputs = { self.nodes[0].getnewaddress() : 2.2 }
outputs = { self.nodes[0].getnewaddress() : 22 }
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
dec_tx = self.nodes[2].decoderawtransaction(rawtx)

Expand All @@ -90,7 +90,7 @@ def run_test(self):
# simple test with two coins #
##############################
inputs = [ ]
outputs = { self.nodes[0].getnewaddress() : 2.6 }
outputs = { self.nodes[0].getnewaddress() : 26 }
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
dec_tx = self.nodes[2].decoderawtransaction(rawtx)

Expand All @@ -105,7 +105,7 @@ def run_test(self):
# simple test with two outputs #
################################
inputs = [ ]
outputs = { self.nodes[0].getnewaddress() : 2.6, self.nodes[1].getnewaddress() : 2.5 }
outputs = { self.nodes[0].getnewaddress() : 26, self.nodes[1].getnewaddress() : 25 }
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
dec_tx = self.nodes[2].decoderawtransaction(rawtx)

Expand All @@ -126,14 +126,14 @@ def run_test(self):
utx = False
listunspent = self.nodes[2].listunspent()
for aUtx in listunspent:
if aUtx['amount'] == 5.0:
if aUtx['amount'] == 50:
utx = aUtx
break

assert_equal(utx!=False, True)

inputs = [ {'txid' : utx['txid'], 'vout' : utx['vout']}]
outputs = { self.nodes[0].getnewaddress() : 1.0 }
outputs = { self.nodes[0].getnewaddress() : 10 }
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
assert_equal(utx['txid'], dec_tx['vin'][0]['txid'])
Expand All @@ -155,14 +155,14 @@ def run_test(self):
utx = False
listunspent = self.nodes[2].listunspent()
for aUtx in listunspent:
if aUtx['amount'] == 5.0:
if aUtx['amount'] == 50:
utx = aUtx
break

assert_equal(utx!=False, True)

inputs = [ {'txid' : utx['txid'], 'vout' : utx['vout']}]
outputs = { self.nodes[0].getnewaddress() : Decimal(5.0) - fee - feeTolerance }
outputs = { self.nodes[0].getnewaddress() : Decimal(50) - fee - feeTolerance }
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
assert_equal(utx['txid'], dec_tx['vin'][0]['txid'])
Expand All @@ -185,14 +185,14 @@ def run_test(self):
utx = False
listunspent = self.nodes[2].listunspent()
for aUtx in listunspent:
if aUtx['amount'] == 1.0:
if aUtx['amount'] == 10:
utx = aUtx
break

assert_equal(utx!=False, True)

inputs = [ {'txid' : utx['txid'], 'vout' : utx['vout']}]
outputs = { self.nodes[0].getnewaddress() : 1.0 }
outputs = { self.nodes[0].getnewaddress() : 10 }
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)

# 4-byte version + 1-byte vin count + 36-byte prevout then script_len
Expand Down Expand Up @@ -228,16 +228,16 @@ def run_test(self):
utx2 = False
listunspent = self.nodes[2].listunspent()
for aUtx in listunspent:
if aUtx['amount'] == 1.0:
if aUtx['amount'] == 10:
utx = aUtx
if aUtx['amount'] == 5.0:
if aUtx['amount'] == 50:
utx2 = aUtx


assert_equal(utx!=False, True)

inputs = [ {'txid' : utx['txid'], 'vout' : utx['vout']},{'txid' : utx2['txid'], 'vout' : utx2['vout']} ]
outputs = { self.nodes[0].getnewaddress() : 6.0 }
outputs = { self.nodes[0].getnewaddress() : 60 }
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
assert_equal(utx['txid'], dec_tx['vin'][0]['txid'])
Expand Down Expand Up @@ -270,16 +270,16 @@ def run_test(self):
utx2 = False
listunspent = self.nodes[2].listunspent()
for aUtx in listunspent:
if aUtx['amount'] == 1.0:
if aUtx['amount'] == 10:
utx = aUtx
if aUtx['amount'] == 5.0:
if aUtx['amount'] == 50:
utx2 = aUtx


assert_equal(utx!=False, True)

inputs = [ {'txid' : utx['txid'], 'vout' : utx['vout']},{'txid' : utx2['txid'], 'vout' : utx2['vout']} ]
outputs = { self.nodes[0].getnewaddress() : 6.0, self.nodes[0].getnewaddress() : 1.0 }
outputs = { self.nodes[0].getnewaddress() : 60, self.nodes[0].getnewaddress() : 10 }
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
assert_equal(utx['txid'], dec_tx['vin'][0]['txid'])
Expand All @@ -302,7 +302,7 @@ def run_test(self):
##############################################
listunspent = self.nodes[2].listunspent()
inputs = [ {'txid' : "1c7f966dab21119bac53213a2bc7532bff1fa844c124fd750a7d0b1332440bd1", 'vout' : 0} ] #invalid vin!
outputs = { self.nodes[0].getnewaddress() : 1.0}
outputs = { self.nodes[0].getnewaddress() : 10}
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
dec_tx = self.nodes[2].decoderawtransaction(rawtx)

Expand All @@ -319,12 +319,12 @@ def run_test(self):
############################################################
#compare fee of a standard pubkeyhash transaction
inputs = []
outputs = {self.nodes[1].getnewaddress():1.1}
outputs = {self.nodes[1].getnewaddress():11}
rawTx = self.nodes[0].createrawtransaction(inputs, outputs)
fundedTx = self.nodes[0].fundrawtransaction(rawTx)

#create same transaction over sendtoaddress
txId = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 1.1)
txId = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 11)
signedFee = self.nodes[0].getrawmempool(True)[txId]['fee']

#compare fee
Expand All @@ -335,7 +335,7 @@ def run_test(self):
############################################################
#compare fee of a standard pubkeyhash transaction with multiple outputs
inputs = []
outputs = {self.nodes[1].getnewaddress():1.1,self.nodes[1].getnewaddress():1.2,self.nodes[1].getnewaddress():0.1,self.nodes[1].getnewaddress():1.3,self.nodes[1].getnewaddress():0.2,self.nodes[1].getnewaddress():0.3}
outputs = {self.nodes[1].getnewaddress():11,self.nodes[1].getnewaddress():12,self.nodes[1].getnewaddress():1,self.nodes[1].getnewaddress():13,self.nodes[1].getnewaddress():2,self.nodes[1].getnewaddress():3}
rawTx = self.nodes[0].createrawtransaction(inputs, outputs)
fundedTx = self.nodes[0].fundrawtransaction(rawTx)
#create same transaction over sendtoaddress
Expand All @@ -361,12 +361,12 @@ def run_test(self):
mSigObj = self.nodes[1].addmultisigaddress(2, [addr1Obj['pubkey'], addr2Obj['pubkey']])

inputs = []
outputs = {mSigObj:1.1}
outputs = {mSigObj:11}
rawTx = self.nodes[0].createrawtransaction(inputs, outputs)
fundedTx = self.nodes[0].fundrawtransaction(rawTx)

#create same transaction over sendtoaddress
txId = self.nodes[0].sendtoaddress(mSigObj, 1.1)
txId = self.nodes[0].sendtoaddress(mSigObj, 11)
signedFee = self.nodes[0].getrawmempool(True)[txId]['fee']

#compare fee
Expand Down Expand Up @@ -394,12 +394,12 @@ def run_test(self):
mSigObj = self.nodes[1].addmultisigaddress(4, [addr1Obj['pubkey'], addr2Obj['pubkey'], addr3Obj['pubkey'], addr4Obj['pubkey'], addr5Obj['pubkey']])

inputs = []
outputs = {mSigObj:1.1}
outputs = {mSigObj:11}
rawTx = self.nodes[0].createrawtransaction(inputs, outputs)
fundedTx = self.nodes[0].fundrawtransaction(rawTx)

#create same transaction over sendtoaddress
txId = self.nodes[0].sendtoaddress(mSigObj, 1.1)
txId = self.nodes[0].sendtoaddress(mSigObj, 11)
signedFee = self.nodes[0].getrawmempool(True)[txId]['fee']

#compare fee
Expand All @@ -421,15 +421,15 @@ def run_test(self):
mSigObj = self.nodes[2].addmultisigaddress(2, [addr1Obj['pubkey'], addr2Obj['pubkey']])


# send 1.2 BTC to msig addr
txId = self.nodes[0].sendtoaddress(mSigObj, 1.2)
# send 12 DASH to msig addr
txId = self.nodes[0].sendtoaddress(mSigObj, 12)
self.sync_all()
self.nodes[1].generate(1)
self.sync_all()

oldBalance = self.nodes[1].getbalance()
inputs = []
outputs = {self.nodes[1].getnewaddress():1.1}
outputs = {self.nodes[1].getnewaddress():11}
rawTx = self.nodes[2].createrawtransaction(inputs, outputs)
fundedTx = self.nodes[2].fundrawtransaction(rawTx)

Expand All @@ -440,7 +440,7 @@ def run_test(self):
self.sync_all()

# make sure funds are received at node1
assert_equal(oldBalance+Decimal('1.10000000'), self.nodes[1].getbalance())
assert_equal(oldBalance+Decimal('11.0000000'), self.nodes[1].getbalance())

############################################################
# locked wallet test
Expand All @@ -464,15 +464,15 @@ def run_test(self):

error = False
try:
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1.2)
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 12)
except:
error = True
assert(error)

oldBalance = self.nodes[0].getbalance()

inputs = []
outputs = {self.nodes[0].getnewaddress():1.1}
outputs = {self.nodes[0].getnewaddress():11}
rawTx = self.nodes[1].createrawtransaction(inputs, outputs)
fundedTx = self.nodes[1].fundrawtransaction(rawTx)

Expand All @@ -485,7 +485,7 @@ def run_test(self):
self.sync_all()

# make sure funds are received at node1
assert_equal(oldBalance+Decimal('51.10000000'), self.nodes[0].getbalance())
assert_equal(oldBalance+Decimal('511.0000000'), self.nodes[0].getbalance())



Expand Down Expand Up @@ -548,7 +548,7 @@ def run_test(self):
self.sync_all()
self.nodes[0].generate(1)
self.sync_all()
assert_equal(oldBalance+Decimal('50.19000000'), self.nodes[0].getbalance()) #0.19+block reward
assert_equal(oldBalance+Decimal('500.19000000'), self.nodes[0].getbalance()) #0.19+block reward

#####################################################
# test fundrawtransaction with OP_RETURN and no vin #
Expand Down
2 changes: 1 addition & 1 deletion qa/rpc-tests/invalidblockrequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def get_tests(self):
'''
block3 = create_block(self.tip, create_coinbase(height), self.block_time)
self.block_time += 1
block3.vtx[0].vout[0].nValue = 100*100000000 # Too high!
block3.vtx[0].vout[0].nValue = 1000*100000000 # Too high!
block3.vtx[0].sha256=None
block3.vtx[0].calc_sha256()
block3.hashMerkleRoot = block3.calc_merkle_root()
Expand Down
3 changes: 2 additions & 1 deletion qa/rpc-tests/listtransactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ def run_test(self):
{"category":"receive","amount":Decimal("0.1")},
{"txid":txid, "account" : "watchonly"} )

self.run_rbf_opt_in_test()
# rbf is disabled in Dash
# self.run_rbf_opt_in_test()

# Check that the opt-in-rbf flag works properly, for sent and received
# transactions.
Expand Down
2 changes: 1 addition & 1 deletion qa/rpc-tests/maxuploadtarget.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __init__(self):
def add_options(self, parser):
parser.add_option("--testbinary", dest="testbinary",
default=os.getenv("DASHD", "dashd"),
help="bitcoind binary to test")
help="dashd binary to test")

def setup_chain(self):
initialize_chain_clean(self.options.tmpdir, 2)
Expand Down
2 changes: 1 addition & 1 deletion qa/rpc-tests/mempool_limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def setup_chain(self):

def run_test(self):
txids = []
utxos = create_confirmed_utxos(self.relayfee, self.nodes[0], 90)
utxos = create_confirmed_utxos(self.relayfee, self.nodes[0], 490)

#create a mempool tx that will be evicted
us0 = utxos.pop()
Expand Down
Loading