mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Reorganize testnet constants
This commit is contained in:
parent
79862ad1de
commit
fb4146fa34
14 changed files with 68 additions and 80 deletions
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue