diff options
| author | Max K <[email protected]> | 2020-07-22 21:16:28 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-07-22 21:16:28 +0200 |
| commit | b0d25579cbde6920d570d4b89c7a2bd844d76fd8 (patch) | |
| tree | 35d9ad526638ee84e1b6bf4019d23aaed8c4f819 /qa | |
| parent | Merge pull request #1631 from m-primo/patch-1 (diff) | |
| parent | fix cents->coins in comment in wallet_tests.cpp (diff) | |
| download | archived-discoin-b0d25579cbde6920d570d4b89c7a2bd844d76fd8.tar.xz archived-discoin-b0d25579cbde6920d570d4b89c7a2bd844d76fd8.zip | |
Merge pull request #1636 from patricklodder/1.14-fix-tests
QA: Fix all the tests
Diffstat (limited to 'qa')
| -rwxr-xr-x | qa/pull-tester/install-deps.sh | 2 | ||||
| -rwxr-xr-x | qa/pull-tester/rpc-tests.py | 2 | ||||
| -rwxr-xr-x | qa/rpc-tests/fundrawtransaction.py | 80 | ||||
| -rwxr-xr-x | qa/rpc-tests/importprunedfunds.py | 27 | ||||
| -rwxr-xr-x | qa/rpc-tests/listtransactions.py | 5 | ||||
| -rwxr-xr-x | qa/rpc-tests/mempool_limit.py | 4 | ||||
| -rwxr-xr-x | qa/rpc-tests/multi_rpc.py | 4 | ||||
| -rw-r--r-- | qa/rpc-tests/test_framework/auxpow.py | 8 | ||||
| -rwxr-xr-x | qa/rpc-tests/test_framework/mininode.py | 4 | ||||
| -rw-r--r-- | qa/rpc-tests/test_framework/scrypt_auxpow.py | 18 |
10 files changed, 78 insertions, 76 deletions
diff --git a/qa/pull-tester/install-deps.sh b/qa/pull-tester/install-deps.sh index e54bfe1cd..2144b5fbc 100755 --- a/qa/pull-tester/install-deps.sh +++ b/qa/pull-tester/install-deps.sh @@ -2,7 +2,7 @@ # installs test dependencies -wget https://github.com/langerhans/ltc-scrypt/archive/master.tar.gz +curl -L https://github.com/langerhans/ltc-scrypt/archive/master.tar.gz --output master.tar.gz echo "ade3cdf498927990b6d153d74f0da104114e838584be5a81bef8972accd03341 master.tar.gz" | sha256sum -c tar zxf master.tar.gz pushd ltc-scrypt-master diff --git a/qa/pull-tester/rpc-tests.py b/qa/pull-tester/rpc-tests.py index 797e876f7..e278b7251 100755 --- a/qa/pull-tester/rpc-tests.py +++ b/qa/pull-tester/rpc-tests.py @@ -281,7 +281,7 @@ class RPCTestHandler: log_stderr = tempfile.SpooledTemporaryFile(max_size=2**16) self.jobs.append((t, time.time(), - subprocess.Popen(['python3.6']+(RPC_TESTS_DIR + t).split() + self.flags + port_seed, + subprocess.Popen(['python3']+(RPC_TESTS_DIR + t).split() + self.flags + port_seed, universal_newlines=True, stdout=log_stdout, stderr=log_stderr), diff --git a/qa/rpc-tests/fundrawtransaction.py b/qa/rpc-tests/fundrawtransaction.py index 643b5ee32..857d48220 100755 --- a/qa/rpc-tests/fundrawtransaction.py +++ b/qa/rpc-tests/fundrawtransaction.py @@ -55,13 +55,13 @@ class RawTransactionsTest(BitcoinTestFramework): self.sync_all() # ensure that setting changePosition in fundraw with an exact match is handled properly - rawmatch = self.nodes[2].createrawtransaction([], {self.nodes[2].getnewaddress():50}) + rawmatch = self.nodes[2].createrawtransaction([], {self.nodes[2].getnewaddress():500000}) rawmatch = self.nodes[2].fundrawtransaction(rawmatch, {"changePosition":1, "subtractFeeFromOutputs":[0]}) assert_equal(rawmatch["changepos"], -1) - 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.nodes[0].generate(1) self.sync_all() @@ -82,7 +82,7 @@ class RawTransactionsTest(BitcoinTestFramework): # 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) @@ -95,7 +95,7 @@ class RawTransactionsTest(BitcoinTestFramework): # 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) @@ -110,7 +110,7 @@ class RawTransactionsTest(BitcoinTestFramework): # 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) @@ -128,10 +128,10 @@ class RawTransactionsTest(BitcoinTestFramework): ######################################################################### # test a fundrawtransaction with a VIN greater than the required amount # ######################################################################### - utx = get_unspent(self.nodes[2].listunspent(), 5) + utx = get_unspent(self.nodes[2].listunspent(), 50) 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']) @@ -149,11 +149,11 @@ class RawTransactionsTest(BitcoinTestFramework): ##################################################################### # test a fundrawtransaction with which will not get a change output # ##################################################################### - utx = get_unspent(self.nodes[2].listunspent(), 5) + utx = get_unspent(self.nodes[2].listunspent(), 50) inputs = [ {'txid' : utx['txid'], 'vout' : utx['vout']}] # Dogecoin: Fee is exact, do not use tolerance - outputs = { self.nodes[0].getnewaddress() : Decimal(5.0) - fee } + outputs = { self.nodes[0].getnewaddress() : Decimal(50) - fee } rawtx = self.nodes[2].createrawtransaction(inputs, outputs) dec_tx = self.nodes[2].decoderawtransaction(rawtx) assert_equal(utx['txid'], dec_tx['vin'][0]['txid']) @@ -172,10 +172,10 @@ class RawTransactionsTest(BitcoinTestFramework): #################################################### # test a fundrawtransaction with an invalid option # #################################################### - utx = get_unspent(self.nodes[2].listunspent(), 5) + utx = get_unspent(self.nodes[2].listunspent(), 50) inputs = [ {'txid' : utx['txid'], 'vout' : utx['vout']} ] - outputs = { self.nodes[0].getnewaddress() : Decimal(4.0) } + outputs = { self.nodes[0].getnewaddress() : Decimal(40) } rawtx = self.nodes[2].createrawtransaction(inputs, outputs) dec_tx = self.nodes[2].decoderawtransaction(rawtx) assert_equal(utx['txid'], dec_tx['vin'][0]['txid']) @@ -185,24 +185,24 @@ class RawTransactionsTest(BitcoinTestFramework): ############################################################ # test a fundrawtransaction with an invalid change address # ############################################################ - utx = get_unspent(self.nodes[2].listunspent(), 5) + utx = get_unspent(self.nodes[2].listunspent(), 50) inputs = [ {'txid' : utx['txid'], 'vout' : utx['vout']} ] - outputs = { self.nodes[0].getnewaddress() : Decimal(4.0) } + outputs = { self.nodes[0].getnewaddress() : Decimal(40) } rawtx = self.nodes[2].createrawtransaction(inputs, outputs) dec_tx = self.nodes[2].decoderawtransaction(rawtx) assert_equal(utx['txid'], dec_tx['vin'][0]['txid']) - assert_raises_jsonrpc(-5, "changeAddress must be a valid bitcoin address", self.nodes[2].fundrawtransaction, rawtx, {'changeAddress':'foobar'}) + assert_raises_jsonrpc(-5, "changeAddress must be a valid dogecoin address", self.nodes[2].fundrawtransaction, rawtx, {'changeAddress':'foobar'}) ############################################################ # test a fundrawtransaction with a provided change address # ############################################################ - utx = get_unspent(self.nodes[2].listunspent(), 5) + utx = get_unspent(self.nodes[2].listunspent(), 50) inputs = [ {'txid' : utx['txid'], 'vout' : utx['vout']} ] # Dogecoin: Reduce this output so the fee doesn't leave us with no change - outputs = { self.nodes[0].getnewaddress() : Decimal(2.5) } + outputs = { self.nodes[0].getnewaddress() : Decimal(25) } rawtx = self.nodes[2].createrawtransaction(inputs, outputs) dec_tx = self.nodes[2].decoderawtransaction(rawtx) assert_equal(utx['txid'], dec_tx['vin'][0]['txid']) @@ -218,10 +218,10 @@ class RawTransactionsTest(BitcoinTestFramework): ######################################################################### # test a fundrawtransaction with a VIN smaller than the required amount # ######################################################################### - utx = get_unspent(self.nodes[2].listunspent(), 1) + utx = get_unspent(self.nodes[2].listunspent(), 10) 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 @@ -253,11 +253,11 @@ class RawTransactionsTest(BitcoinTestFramework): ########################################### # test a fundrawtransaction with two VINs # ########################################### - utx = get_unspent(self.nodes[2].listunspent(), 1) - utx2 = get_unspent(self.nodes[2].listunspent(), 5) + utx = get_unspent(self.nodes[2].listunspent(), 10) + utx2 = get_unspent(self.nodes[2].listunspent(), 50) 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']) @@ -286,11 +286,11 @@ class RawTransactionsTest(BitcoinTestFramework): ######################################################### # test a fundrawtransaction with two VINs and two vOUTs # ######################################################### - utx = get_unspent(self.nodes[2].listunspent(), 1) - utx2 = get_unspent(self.nodes[2].listunspent(), 5) + utx = get_unspent(self.nodes[2].listunspent(), 10) + utx2 = get_unspent(self.nodes[2].listunspent(), 50) 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']) @@ -313,7 +313,7 @@ class RawTransactionsTest(BitcoinTestFramework): ############################################## 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) @@ -322,12 +322,12 @@ class RawTransactionsTest(BitcoinTestFramework): ############################################################ #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 @@ -338,7 +338,7 @@ class RawTransactionsTest(BitcoinTestFramework): ############################################################ #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():110,self.nodes[1].getnewaddress():120,self.nodes[1].getnewaddress():10,self.nodes[1].getnewaddress():130,self.nodes[1].getnewaddress():20,self.nodes[1].getnewaddress():30} rawTx = self.nodes[0].createrawtransaction(inputs, outputs) fundedTx = self.nodes[0].fundrawtransaction(rawTx) #create same transaction over sendtoaddress @@ -369,7 +369,7 @@ class RawTransactionsTest(BitcoinTestFramework): 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 @@ -402,7 +402,7 @@ class RawTransactionsTest(BitcoinTestFramework): 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 @@ -425,14 +425,14 @@ class RawTransactionsTest(BitcoinTestFramework): # send 1.2 BTC to msig addr - txId = self.nodes[0].sendtoaddress(mSigObj, 1.2) + 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) @@ -443,7 +443,7 @@ class RawTransactionsTest(BitcoinTestFramework): 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 @@ -469,7 +469,7 @@ class RawTransactionsTest(BitcoinTestFramework): # drain the keypool self.nodes[1].getnewaddress() inputs = [] - outputs = {self.nodes[0].getnewaddress():1.1} + outputs = {self.nodes[0].getnewaddress():11} rawTx = self.nodes[1].createrawtransaction(inputs, outputs) # fund a transaction that requires a new key for the change output # creating the key must be impossible because the wallet is locked @@ -479,12 +479,12 @@ class RawTransactionsTest(BitcoinTestFramework): self.nodes[1].walletpassphrase("test", 100) self.nodes[1].walletlock() - assert_raises_jsonrpc(-13, "walletpassphrase", self.nodes[1].sendtoaddress, self.nodes[0].getnewaddress(), 1.2) + assert_raises_jsonrpc(-13, "walletpassphrase", self.nodes[1].sendtoaddress, self.nodes[0].getnewaddress(), 12) 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) @@ -496,7 +496,7 @@ class RawTransactionsTest(BitcoinTestFramework): self.sync_all() # make sure funds are received at node1 - assert_equal(oldBalance+Decimal('500001.10000000'), self.nodes[0].getbalance()) + assert_equal(oldBalance+Decimal('500011.00000000'), self.nodes[0].getbalance()) ############################################### @@ -510,7 +510,7 @@ class RawTransactionsTest(BitcoinTestFramework): self.sync_all() for i in range(0,20): - self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 2) + self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 20) self.nodes[0].generate(1) self.sync_all() diff --git a/qa/rpc-tests/importprunedfunds.py b/qa/rpc-tests/importprunedfunds.py index b289f9be5..ef481d32d 100755 --- a/qa/rpc-tests/importprunedfunds.py +++ b/qa/rpc-tests/importprunedfunds.py @@ -25,7 +25,7 @@ class ImportPrunedFundsTest(BitcoinTestFramework): self.nodes[0].generate(101) self.sync_all() - + # address address1 = self.nodes[0].getnewaddress() # pubkey @@ -58,20 +58,21 @@ class ImportPrunedFundsTest(BitcoinTestFramework): assert_equal(address_info['ismine'], False) #Send funds to self - txnid1 = self.nodes[0].sendtoaddress(address1, 0.1) + txnid3 = self.nodes[0].sendtoaddress(address3, 2.5) self.nodes[0].generate(1) - rawtxn1 = self.nodes[0].gettransaction(txnid1)['hex'] - proof1 = self.nodes[0].gettxoutproof([txnid1]) + rawtxn3 = self.nodes[0].gettransaction(txnid3)['hex'] + proof3 = self.nodes[0].gettxoutproof([txnid3]) - txnid2 = self.nodes[0].sendtoaddress(address2, 0.05) + txnid2 = self.nodes[0].sendtoaddress(address2, 5) self.nodes[0].generate(1) rawtxn2 = self.nodes[0].gettransaction(txnid2)['hex'] proof2 = self.nodes[0].gettxoutproof([txnid2]) - txnid3 = self.nodes[0].sendtoaddress(address3, 0.025) + txnid1 = self.nodes[0].sendtoaddress(address1, 10) self.nodes[0].generate(1) - rawtxn3 = self.nodes[0].gettransaction(txnid3)['hex'] - proof3 = self.nodes[0].gettxoutproof([txnid3]) + rawtxn1 = self.nodes[0].gettransaction(txnid1)['hex'] + proof1 = self.nodes[0].gettxoutproof([txnid1]) + self.sync_all() @@ -85,15 +86,15 @@ class ImportPrunedFundsTest(BitcoinTestFramework): self.nodes[1].importaddress(address2, "add2", False) result2 = self.nodes[1].importprunedfunds(rawtxn2, proof2) balance2 = self.nodes[1].getbalance("add2", 0, True) - assert_equal(balance2, Decimal('0.05')) + assert_equal(balance2, Decimal('5')) #Import with private key with no rescan self.nodes[1].importprivkey(address3_privkey, "add3", False) result3 = self.nodes[1].importprunedfunds(rawtxn3, proof3) balance3 = self.nodes[1].getbalance("add3", 0, False) - assert_equal(balance3, Decimal('0.025')) + assert_equal(balance3, Decimal('2.5')) balance3 = self.nodes[1].getbalance("*", 0, True) - assert_equal(balance3, Decimal('0.075')) + assert_equal(balance3, Decimal('7.5')) #Addresses Test - after import address_info = self.nodes[1].validateaddress(address1) @@ -110,11 +111,11 @@ class ImportPrunedFundsTest(BitcoinTestFramework): assert_raises_jsonrpc(-8, "Transaction does not exist in wallet.", self.nodes[1].removeprunedfunds, txnid1) balance1 = self.nodes[1].getbalance("*", 0, True) - assert_equal(balance1, Decimal('0.075')) + assert_equal(balance1, Decimal('7.5')) self.nodes[1].removeprunedfunds(txnid2) balance2 = self.nodes[1].getbalance("*", 0, True) - assert_equal(balance2, Decimal('0.025')) + assert_equal(balance2, Decimal('2.5')) self.nodes[1].removeprunedfunds(txnid3) balance3 = self.nodes[1].getbalance("*", 0, True) diff --git a/qa/rpc-tests/listtransactions.py b/qa/rpc-tests/listtransactions.py index 83ac72505..2eda29ce9 100755 --- a/qa/rpc-tests/listtransactions.py +++ b/qa/rpc-tests/listtransactions.py @@ -90,12 +90,12 @@ class ListTransactionsTest(BitcoinTestFramework): multisig = self.nodes[1].createmultisig(1, [self.nodes[1].getnewaddress()]) self.nodes[0].importaddress(multisig["redeemScript"], "watchonly", False, True) - txid = self.nodes[1].sendtoaddress(multisig["address"], 0.1) + txid = self.nodes[1].sendtoaddress(multisig["address"], 1) self.nodes[1].generate(1) self.sync_all() assert(len(self.nodes[0].listtransactions("watchonly", 100, 0, False)) == 0) assert_array_result(self.nodes[0].listtransactions("watchonly", 100, 0, True), - {"category":"receive","amount":Decimal("0.1")}, + {"category":"receive","amount":Decimal("1")}, {"txid":txid, "account" : "watchonly"} ) self.run_rbf_opt_in_test() @@ -201,4 +201,3 @@ class ListTransactionsTest(BitcoinTestFramework): if __name__ == '__main__': ListTransactionsTest().main() - diff --git a/qa/rpc-tests/mempool_limit.py b/qa/rpc-tests/mempool_limit.py index b3fe289c6..f7b4259a6 100755 --- a/qa/rpc-tests/mempool_limit.py +++ b/qa/rpc-tests/mempool_limit.py @@ -26,7 +26,7 @@ class MempoolLimitTest(BitcoinTestFramework): def run_test(self): txids = [] - utxos = create_confirmed_utxos(self.relayfee, self.nodes[0], 91) + utxos = create_confirmed_utxos(self.relayfee, self.nodes[0], 181) #create a mempool tx that will be evicted us0 = utxos.pop() @@ -41,7 +41,7 @@ class MempoolLimitTest(BitcoinTestFramework): relayfee = self.nodes[0].getnetworkinfo()['relayfee'] base_fee = relayfee*100 - for i in range (3): + for i in range (6): txids.append([]) txids[i] = create_lots_of_big_transactions(self.nodes[0], self.txouts, utxos[30*i:30*i+30], 30, (i+1)*base_fee) diff --git a/qa/rpc-tests/multi_rpc.py b/qa/rpc-tests/multi_rpc.py index 95d9090ce..2facf6c9c 100755 --- a/qa/rpc-tests/multi_rpc.py +++ b/qa/rpc-tests/multi_rpc.py @@ -26,7 +26,7 @@ class HTTPBasicsTest (BitcoinTestFramework): #Append rpcauth to bitcoin.conf before initialization rpcauth = "rpcauth=rt:93648e835a54c573682c2eb19f882535$7681e9c5b74bdd85e78166031d2058e1069b3ed7ed967c93fc63abba06f31144" rpcauth2 = "rpcauth=rt2:f8607b1a88861fac29dfccf9b52ff9f$ff36a0c23c8c62b4846112e50fa888416e94c17bfd4c42f88fd8f55ec6a3137e" - with open(os.path.join(self.options.tmpdir+"/node0", "bitcoin.conf"), 'a', encoding='utf8') as f: + with open(os.path.join(self.options.tmpdir+"/node0", "dogecoin.conf"), 'a', encoding='utf8') as f: f.write(rpcauth+"\n") f.write(rpcauth2+"\n") @@ -60,7 +60,7 @@ class HTTPBasicsTest (BitcoinTestFramework): resp = conn.getresponse() assert_equal(resp.status==401, False) conn.close() - + #Use new authpair to confirm both work headers = {"Authorization": "Basic " + str_to_b64str(authpairnew)} diff --git a/qa/rpc-tests/test_framework/auxpow.py b/qa/rpc-tests/test_framework/auxpow.py index 4f5ce20c0..cb1cdff06 100644 --- a/qa/rpc-tests/test_framework/auxpow.py +++ b/qa/rpc-tests/test_framework/auxpow.py @@ -17,7 +17,7 @@ def computeAuxpow (block, target, ok): # Start by building the merge-mining coinbase. The merkle tree # consists only of the block hash as root. - coinbase = "fabe" + binascii.hexlify ("m" * 2) + coinbase = "fabe" + binascii.hexlify("m" * 2) coinbase += block coinbase += "01000000" + ("00" * 4) @@ -63,7 +63,7 @@ def mineAuxpowBlock (node): """ auxblock = node.getauxblock () - target = reverseHex (auxblock['_target']) + target = reverseHex (auxblock['target']) apow = computeAuxpow (auxblock['hash'], target, True) res = node.getauxblock (auxblock['hash'], apow) assert res @@ -105,7 +105,7 @@ def reverseHex (data): Flip byte order in the given data (hex string). """ - b = bytearray (bytes.fromhex(data)) + b = bytearray (binascii.unhexlify(data)) b.reverse () - return b.hex() + return binascii.hexlify(b).decode("ascii") diff --git a/qa/rpc-tests/test_framework/mininode.py b/qa/rpc-tests/test_framework/mininode.py index 89d0ae4f1..0b4b0dc1d 100755 --- a/qa/rpc-tests/test_framework/mininode.py +++ b/qa/rpc-tests/test_framework/mininode.py @@ -36,7 +36,7 @@ from threading import RLock from threading import Thread import logging import copy -import litecoin_scrypt +import ltc_scrypt from test_framework.siphash import siphash256 BIP0031_VERSION = 60000 @@ -583,7 +583,7 @@ class CBlockHeader(object): r += struct.pack("<I", self.nNonce) self.sha256 = uint256_from_str(hash256(r)) self.hash = encode(hash256(r)[::-1], 'hex_codec').decode('ascii') - self.scrypt256 = uint256_from_str(litecoin_scrypt.getPoWHash(r)) + self.scrypt256 = uint256_from_str(ltc_scrypt.getPoWHash(r)) def rehash(self): self.sha256 = None diff --git a/qa/rpc-tests/test_framework/scrypt_auxpow.py b/qa/rpc-tests/test_framework/scrypt_auxpow.py index 7cb68ee03..dda54e28b 100644 --- a/qa/rpc-tests/test_framework/scrypt_auxpow.py +++ b/qa/rpc-tests/test_framework/scrypt_auxpow.py @@ -8,12 +8,13 @@ # solve an auxpow header and to generate auxpow blocks with scrypt. # extends and modifies auxpow module by Daniel Kraft. -# This module requires a built and installed version of the litecoin_scrypt +# This module requires a built and installed version of the ltc_scrypt # package, which can be downloaded from: # https://pypi.python.org/packages/source/l/ltc_scrypt/ltc_scrypt-1.0.tar.gz from .auxpow import * -import litecoin_scrypt +import ltc_scrypt +import binascii def computeAuxpowWithChainId (block, target, chainid, ok): """ @@ -23,7 +24,7 @@ def computeAuxpowWithChainId (block, target, chainid, ok): # Start by building the merge-mining coinbase. The merkle tree # consists only of the block hash as root. - coinbase = "fabe" + (b"m" * 2).hex() + coinbase = "fabe" + binascii.hexlify((b"m" * 2)).decode("ascii") coinbase += block coinbase += "01000000" + ("00" * 4) @@ -70,7 +71,7 @@ def mineScryptAux (node, chainid, ok): """ auxblock = node.getauxblock () - target = reverseHex (auxblock['_target']) + target = reverseHex (auxblock['target']) apow = computeAuxpowWithChainId (auxblock['hash'], target, chainid, ok) res = node.getauxblock (auxblock['hash'], apow) @@ -82,11 +83,11 @@ def mineScryptBlock (header, target, ok): for the given target. """ - data = bytearray (bytes.fromhex(header)) + data = bytearray (binascii.unhexlify(header)) while True: assert data[79] < 255 data[79] += 1 - hexData = data.hex() + hexData = binascii.hexlify(data).decode("ascii") scrypt = getScryptPoW(hexData) if (ok and scrypt < target) or ((not ok) and scrypt > target): @@ -100,5 +101,6 @@ def getScryptPoW(hexData): Actual scrypt pow calculation """ - data = bytes.fromhex(hexData) - return reverseHex(litecoin_scrypt.getPoWHash(data).hex()) + data = binascii.unhexlify(hexData) + + return reverseHex(binascii.hexlify(ltc_scrypt.getPoWHash(data)).decode("ascii")) |