Skip to content

Commit

Permalink
Fix occasionally failing tests (#2691)
Browse files Browse the repository at this point in the history
* Remove gen from updatemasternode test

* Sync blocks when generating on different nodes

* Sync blocks between nodes

* Use const and reference to prevent counter increment

* Remove unused txindex usage

* Remove redundant check

* Restore build for make.sh users
  • Loading branch information
Bushstar authored Nov 20, 2023
1 parent fa1aca8 commit b454061
Show file tree
Hide file tree
Showing 61 changed files with 53 additions and 122 deletions.
2 changes: 1 addition & 1 deletion src/dfi/mn_rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ std::vector<CTxIn> GetAuthInputsSmart(CWalletCoinsUnlocker &pwallet,
return result;
}

void execTestTx(const CTransaction &tx, uint32_t height, CTransactionRef optAuthTx) {
void execTestTx(const CTransaction &tx, const uint32_t height, const CTransactionRef &optAuthTx) {
std::vector<unsigned char> metadata;
auto txType = GuessCustomTxType(tx, metadata);
auto txMessage = customTypeToMessage(txType);
Expand Down
2 changes: 1 addition & 1 deletion src/dfi/mn_rpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ CAccounts GetAllMineAccounts(CWallet *const pwallet);
CAccounts SelectAccountsByTargetBalances(const CAccounts &accounts,
const CBalances &targetBalances,
AccountSelectionMode selectionMode);
void execTestTx(const CTransaction &tx, uint32_t height, CTransactionRef optAuthTx = {});
void execTestTx(const CTransaction &tx, const uint32_t height, const CTransactionRef &optAuthTx = {});
CScript CreateScriptForHTLC(const JSONRPCRequest &request, uint32_t &blocks, std::vector<unsigned char> &image);
CPubKey PublickeyFromString(const std::string &pubkey);
std::optional<CScript> AmIFounder(CWallet *const pwallet);
Expand Down
2 changes: 0 additions & 2 deletions test/functional/feature_address_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
],
[
"-dummypos=0",
Expand All @@ -55,7 +54,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
],
]

Expand Down
2 changes: 1 addition & 1 deletion test/functional/feature_anchor_rewards.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def run_test(self):

# check confirmations (revoting) after node restart:
self.stop_node(0)
self.start_node(0, ["-txindex=1", "-amkheight=0", "-dakotaheight=1"])
self.start_node(0, ["-amkheight=0", "-dakotaheight=1"])
connect_nodes_bi(self.nodes, 0, 1)
self.sync_blocks(self.nodes[0:2])
wait_until(
Expand Down
15 changes: 9 additions & 6 deletions test/functional/feature_auth_return_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ def set_test_params(self):
self.setup_clean_chain = True
self.extra_args = [
[
"-txindex=1",
"-txnotokens=0",
"-amkheight=50",
"-bayfrontheight=50",
Expand All @@ -37,12 +36,14 @@ def clear_auth_utxos(self):
# Check output/input count and addresses are expected
def check_auto_auth_txs(self, tx, owner, outputs=2):
# Get auto auth TXs
final_rawtx = self.nodes[0].getrawtransaction(tx, 1)
auth_tx = self.nodes[0].getrawtransaction(final_rawtx["vin"][0]["txid"], 1)
get_tx = self.nodes[0].gettransaction(tx)["hex"]
final_rawtx = self.nodes[0].decoderawtransaction(get_tx)
get_tx = self.nodes[0].gettransaction(final_rawtx["vin"][0]["txid"])["hex"]
auth_tx = self.nodes[0].decoderawtransaction(get_tx)

# Auth TX outputs all belong to auth address
assert_equal(auth_tx["vout"][1]["scriptPubKey"]["addresses"][0], owner)
decTx = self.nodes[0].getrawtransaction(tx)
decTx = self.nodes[0].gettransaction(tx)["hex"]
customTx = self.nodes[0].decodecustomtx(decTx)
vouts = 2
if customTx["type"] == "ResignMasternode":
Expand Down Expand Up @@ -166,7 +167,8 @@ def run_test(self):
self.nodes[0].generate(1, 1000000, coinbase)

# Change to pool collateral address
final_rawtx = self.nodes[0].getrawtransaction(poolpair_tx, 1)
get_tx = self.nodes[0].gettransaction(poolpair_tx)["hex"]
final_rawtx = self.nodes[0].decoderawtransaction(get_tx)
assert_equal(
final_rawtx["vout"][1]["scriptPubKey"]["addresses"][0],
self.nodes[0].PRIV_KEYS[0].ownerAuthAddress,
Expand Down Expand Up @@ -299,7 +301,8 @@ def run_test(self):
assert_equal(token_c, "2")

# Check auto auth TX
final_rawtx = self.nodes[0].getrawtransaction(create_tx, 1)
get_tx = self.nodes[0].gettransaction(create_tx)["hex"]
final_rawtx = self.nodes[0].decoderawtransaction(get_tx)
assert_equal(
final_rawtx["vout"][2]["scriptPubKey"]["addresses"][0],
self.nodes[0].PRIV_KEYS[0].ownerAuthAddress,
Expand Down
4 changes: 0 additions & 4 deletions test/functional/feature_consortium.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def set_test_params(self):
"-grandcentralheight=254",
"-grandcentralepilogueheight=350",
"-regtest-minttoken-simulate-mainnet=1",
"-txindex=1",
],
[
"-txnotokens=0",
Expand All @@ -50,7 +49,6 @@ def set_test_params(self):
"-grandcentralheight=254",
"-grandcentralepilogueheight=350",
"-regtest-minttoken-simulate-mainnet=1",
"-txindex=1",
],
[
"-txnotokens=0",
Expand All @@ -68,7 +66,6 @@ def set_test_params(self):
"-grandcentralheight=254",
"-grandcentralepilogueheight=350",
"-regtest-minttoken-simulate-mainnet=1",
"-txindex=1",
],
[
"-txnotokens=0",
Expand All @@ -86,7 +83,6 @@ def set_test_params(self):
"-grandcentralheight=254",
"-grandcentralepilogueheight=350",
"-regtest-minttoken-simulate-mainnet=1",
"-txindex=1",
],
]

Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_dusd_loans.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def set_test_params(self):
f"-grandcentralepilogueheight={self.grandcentralepilogueheight}",
f"-metachainheight={self.metachainheight}",
"-jellyfish_regtest=1",
"-txindex=1",
"-simulatemainnet=1",
]
]
Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_evm.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
"-ethdebug=1",
]
self.extra_args = [args, args]
Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_evm_contract_env_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
],
]

Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_evm_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
],
]

Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_evm_dfi_intrinsics.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
],
]

Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_evm_dst20.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
]
]

Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_evm_eip1559_fees.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
]
]

Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_evm_fee.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
],
]

Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_evm_gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
],
]

Expand Down
2 changes: 0 additions & 2 deletions test/functional/feature_evm_genesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
],
]

Expand Down Expand Up @@ -141,7 +140,6 @@ def test_start_state_from_json(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
],
]
self.stop_nodes()
Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_evm_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
],
]

Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_evm_mempool.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
"-ethdebug=1",
],
]
Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_evm_miner.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
],
]

Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_evm_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
],
]

Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_evm_rollback.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
"-ethdebug=1",
],
]
Expand Down
6 changes: 3 additions & 3 deletions test/functional/feature_evm_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
"-ethdebug=1",
],
]
Expand Down Expand Up @@ -358,8 +357,9 @@ def test_block(self):
self.nodes[0].generate(1)

# Test evm tx RPC
block = self.nodes[0].getblock(self.nodes[0].getbestblockhash())
res = self.nodes[0].getcustomtx(block["tx"][1])
block_hash = self.nodes[0].getbestblockhash()
block = self.nodes[0].getblock(block_hash)
res = self.nodes[0].getcustomtx(block["tx"][1], block_hash)
assert_equal(
res["results"]["hash"],
"8c99e9f053e033078e33c2756221f38fd529b914165090a615f27961de687497",
Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_evm_rpc_fee_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
],
]

Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_evm_rpc_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
],
]

Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_evm_rpc_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
"-ethdebug=1",
],
]
Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_evm_smart_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
],
]

Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_evm_transaction_replacement.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
],
]

Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_evm_transferdomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=150",
"-subsidytest=1",
"-txindex=1",
]
self.extra_args = [node_args, node_args]

Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_evm_vmmap_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def set_test_params(self):
"-grandcentralheight=101",
"-metachainheight=105",
"-subsidytest=1",
"-txindex=1",
]
self.extra_args = [extra_args, extra_args]

Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_higher_collateral_factor.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def set_test_params(self):
"-bayfrontheight=1",
"-bayfrontgardensheight=1",
"-eunosheight=1",
"-txindex=1",
"-fortcanningheight=1",
"-fortcanningroadheight=1",
"-fortcanninghillheight=1",
Expand Down
2 changes: 0 additions & 2 deletions test/functional/feature_icx_orderbook_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@ def set_test_params(self):
"-bayfrontheight=50",
"-eunosheight=50",
"-eunospayaheight=50",
"-txindex=1",
],
[
"-txnotokens=0",
"-amkheight=50",
"-bayfrontheight=50",
"-eunosheight=50",
"-eunospayaheight=50",
"-txindex=1",
],
]

Expand Down
2 changes: 0 additions & 2 deletions test/functional/feature_loan.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def set_test_params(self):
"-bayfrontheight=1",
"-bayfrontgardensheight=1",
"-eunosheight=1",
"-txindex=1",
"-fortcanningheight=1",
],
[
Expand All @@ -35,7 +34,6 @@ def set_test_params(self):
"-bayfrontheight=1",
"-bayfrontgardensheight=1",
"-eunosheight=1",
"-txindex=1",
"-fortcanningheight=1",
],
]
Expand Down
1 change: 0 additions & 1 deletion test/functional/feature_loan_auctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def set_test_params(self):
"-amkheight=1",
"-bayfrontheight=1",
"-eunosheight=1",
"-txindex=1",
"-fortcanningheight=1",
]
]
Expand Down
2 changes: 0 additions & 2 deletions test/functional/feature_loan_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def set_test_params(self):
"-fortcanningheight=50",
"-eunosheight=50",
"-fortcanninghillheight=220",
"-txindex=1",
],
[
"-txnotokens=0",
Expand All @@ -37,7 +36,6 @@ def set_test_params(self):
"-bayfrontgardensheight=1",
"-fortcanningheight=50",
"-eunosheight=50",
"-txindex=1",
],
]

Expand Down
Loading

0 comments on commit b454061

Please sign in to comment.