Reorganize testnet constants

This commit is contained in:
Zachary Michaels 2014-09-04 22:14:36 -04:00 committed by Riccardo Spagni
parent 79862ad1de
commit fb4146fa34
14 changed files with 68 additions and 80 deletions

View file

@ -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");