aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorZachary Michaels <mikezackles@gmail.com>2014-09-04 22:14:36 -0400
committerRiccardo Spagni <ric@spagni.net>2014-09-15 15:53:10 +0200
commitfb4146fa343399229c754331ecc78fe0c759ec7c (patch)
tree18dbbb427c846d83590bcf4f959d759dd81b7e5e /tests
parentAdd testnet constants (diff)
downloadmonero-fb4146fa343399229c754331ecc78fe0c759ec7c.tar.xz
Reorganize testnet constants
Diffstat (limited to '')
-rw-r--r--tests/core_proxy/core_proxy.cpp5
-rw-r--r--tests/functional_tests/transactions_flow_test.cpp12
-rw-r--r--tests/unit_tests/base58.cpp6
-rw-r--r--tests/unit_tests/test_format_utils.cpp8
4 files changed, 22 insertions, 9 deletions
diff --git a/tests/core_proxy/core_proxy.cpp b/tests/core_proxy/core_proxy.cpp
index 098b9878a..f973f548d 100644
--- a/tests/core_proxy/core_proxy.cpp
+++ b/tests/core_proxy/core_proxy.cpp
@@ -104,7 +104,10 @@ int main(int argc, char* argv[])
//create objects and link them
tests::proxy_core pr_core;
cryptonote::t_cryptonote_protocol_handler<tests::proxy_core> cprotocol(pr_core, NULL);
- nodetool::node_server<cryptonote::t_cryptonote_protocol_handler<tests::proxy_core> > p2psrv(cprotocol);
+ nodetool::node_server<cryptonote::t_cryptonote_protocol_handler<tests::proxy_core> > p2psrv {
+ cprotocol
+ , std::move(config::NETWORK_ID)
+ };
cprotocol.set_p2p_endpoint(&p2psrv);
//pr_core.set_cryptonote_protocol(&cprotocol);
//daemon_cmmands_handler dch(p2psrv);
diff --git a/tests/functional_tests/transactions_flow_test.cpp b/tests/functional_tests/transactions_flow_test.cpp
index 68c9f7ac7..2187ff250 100644
--- a/tests/functional_tests/transactions_flow_test.cpp
+++ b/tests/functional_tests/transactions_flow_test.cpp
@@ -37,6 +37,12 @@ using namespace epee;
#include "wallet/wallet2.h"
using namespace cryptonote;
+namespace
+{
+ uint64_t const TEST_FEE = 5000000000; // 5 * 10^9
+ uint64_t const TEST_DUST_THRESHOLD = 5000000000; // 5 * 10^9
+}
+
std::string generate_random_wallet_name()
{
std::stringstream ss;
@@ -79,7 +85,7 @@ bool do_send_money(tools::wallet2& w1, tools::wallet2& w2, size_t mix_in_factor,
try
{
tools::wallet2::pending_tx ptx;
- w1.transfer(dsts, mix_in_factor, 0, DEFAULT_FEE, std::vector<uint8_t>(), tools::detail::null_split_strategy, tools::tx_dust_policy(DEFAULT_FEE), tx, ptx);
+ w1.transfer(dsts, mix_in_factor, 0, TEST_FEE, std::vector<uint8_t>(), tools::detail::null_split_strategy, tools::tx_dust_policy(TEST_DUST_THRESHOLD), tx, ptx);
w1.commit_tx(ptx);
return true;
}
@@ -185,7 +191,7 @@ bool transactions_flow_test(std::string& working_folder,
BOOST_FOREACH(tools::wallet2::transfer_details& td, incoming_transfers)
{
cryptonote::transaction tx_s;
- bool r = do_send_money(w1, w1, 0, td.m_tx.vout[td.m_internal_output_index].amount - DEFAULT_FEE, tx_s, 50);
+ bool r = do_send_money(w1, w1, 0, td.m_tx.vout[td.m_internal_output_index].amount - TEST_FEE, tx_s, 50);
CHECK_AND_ASSERT_MES(r, false, "Failed to send starter tx " << get_transaction_hash(tx_s));
LOG_PRINT_GREEN("Starter transaction sent " << get_transaction_hash(tx_s), LOG_LEVEL_0);
if(++count >= FIRST_N_TRANSFERS)
@@ -213,7 +219,7 @@ bool transactions_flow_test(std::string& working_folder,
for(i = 0; i != transactions_count; i++)
{
uint64_t amount_to_tx = (amount_to_transfer - transfered_money) > transfer_size ? transfer_size: (amount_to_transfer - transfered_money);
- while(w1.unlocked_balance() < amount_to_tx + DEFAULT_FEE)
+ while(w1.unlocked_balance() < amount_to_tx + TEST_FEE)
{
misc_utils::sleep_no_w(1000);
LOG_PRINT_L0("not enough money, waiting for cashback or mining");
diff --git a/tests/unit_tests/base58.cpp b/tests/unit_tests/base58.cpp
index 5b82fb987..f61bb1b96 100644
--- a/tests/unit_tests/base58.cpp
+++ b/tests/unit_tests/base58.cpp
@@ -506,7 +506,7 @@ TEST(get_account_address_from_str, fails_on_invalid_address_prefix)
TEST(get_account_address_from_str, fails_on_invalid_address_content)
{
- std::string addr_str = base58::encode_addr(CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX, test_serialized_keys.substr(1));
+ std::string addr_str = base58::encode_addr(config::CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX, test_serialized_keys.substr(1));
cryptonote::account_public_address addr;
ASSERT_FALSE(cryptonote::get_account_address_from_str(addr, addr_str));
@@ -516,7 +516,7 @@ TEST(get_account_address_from_str, fails_on_invalid_address_spend_key)
{
std::string serialized_keys_copy = test_serialized_keys;
serialized_keys_copy[0] = '\0';
- std::string addr_str = base58::encode_addr(CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX, serialized_keys_copy);
+ std::string addr_str = base58::encode_addr(config::CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX, serialized_keys_copy);
cryptonote::account_public_address addr;
ASSERT_FALSE(cryptonote::get_account_address_from_str(addr, addr_str));
@@ -526,7 +526,7 @@ TEST(get_account_address_from_str, fails_on_invalid_address_view_key)
{
std::string serialized_keys_copy = test_serialized_keys;
serialized_keys_copy.back() = '\x01';
- std::string addr_str = base58::encode_addr(CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX, serialized_keys_copy);
+ std::string addr_str = base58::encode_addr(config::CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX, serialized_keys_copy);
cryptonote::account_public_address addr;
ASSERT_FALSE(cryptonote::get_account_address_from_str(addr, addr_str));
diff --git a/tests/unit_tests/test_format_utils.cpp b/tests/unit_tests/test_format_utils.cpp
index bed19c315..857b5b09f 100644
--- a/tests/unit_tests/test_format_utils.cpp
+++ b/tests/unit_tests/test_format_utils.cpp
@@ -35,6 +35,10 @@
#include "common/util.h"
#include "cryptonote_core/cryptonote_format_utils.h"
+namespace
+{
+ uint64_t const TEST_FEE = 5000000000; // 5 * 10^9
+}
TEST(parse_tx_extra, handles_empty_extra)
{
@@ -135,7 +139,7 @@ TEST(parse_and_validate_tx_extra, is_valid_tx_extra_parsed)
cryptonote::account_base acc;
acc.generate();
cryptonote::blobdata b = "dsdsdfsdfsf";
- ASSERT_TRUE(cryptonote::construct_miner_tx(0, 0, 10000000000000, 1000, DEFAULT_FEE, acc.get_keys().m_account_address, tx, b, 1));
+ ASSERT_TRUE(cryptonote::construct_miner_tx(0, 0, 10000000000000, 1000, TEST_FEE, acc.get_keys().m_account_address, tx, b, 1));
crypto::public_key tx_pub_key = cryptonote::get_tx_pub_key_from_extra(tx);
ASSERT_NE(tx_pub_key, cryptonote::null_pkey);
}
@@ -145,7 +149,7 @@ TEST(parse_and_validate_tx_extra, fails_on_big_extra_nonce)
cryptonote::account_base acc;
acc.generate();
cryptonote::blobdata b(TX_EXTRA_NONCE_MAX_COUNT + 1, 0);
- ASSERT_FALSE(cryptonote::construct_miner_tx(0, 0, 10000000000000, 1000, DEFAULT_FEE, acc.get_keys().m_account_address, tx, b, 1));
+ ASSERT_FALSE(cryptonote::construct_miner_tx(0, 0, 10000000000000, 1000, TEST_FEE, acc.get_keys().m_account_address, tx, b, 1));
}
TEST(parse_and_validate_tx_extra, fails_on_wrong_size_in_extra_nonce)
{