mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 18:47:36 -07:00
Reorganize testnet constants
This commit is contained in:
parent
79862ad1de
commit
fb4146fa34
@ -259,7 +259,7 @@ bool handle_request_stat(po::variables_map& vm, peerid_type peer_id)
|
|||||||
pot.peer_id = peer_id;
|
pot.peer_id = peer_id;
|
||||||
pot.time = time(NULL);
|
pot.time = time(NULL);
|
||||||
crypto::public_key pubk = AUTO_VAL_INIT(pubk);
|
crypto::public_key pubk = AUTO_VAL_INIT(pubk);
|
||||||
string_tools::hex_to_pod(P2P_STAT_TRUSTED_PUB_KEY, pubk);
|
string_tools::hex_to_pod(::config::P2P_REMOTE_DEBUG_TRUSTED_PUB_KEY, pubk);
|
||||||
crypto::hash h = tools::get_proof_of_trust_hash(pot);
|
crypto::hash h = tools::get_proof_of_trust_hash(pot);
|
||||||
crypto::generate_signature(h, pubk, prvk, pot.sign);
|
crypto::generate_signature(h, pubk, prvk, pot.sign);
|
||||||
|
|
||||||
|
@ -30,13 +30,14 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <boost/uuid/uuid.hpp>
|
||||||
|
|
||||||
#define CRYPTONOTE_MAX_BLOCK_NUMBER 500000000
|
#define CRYPTONOTE_MAX_BLOCK_NUMBER 500000000
|
||||||
#define CRYPTONOTE_MAX_BLOCK_SIZE 500000000 // block header blob limit, never used!
|
#define CRYPTONOTE_MAX_BLOCK_SIZE 500000000 // block header blob limit, never used!
|
||||||
#define CRYPTONOTE_GETBLOCKTEMPLATE_MAX_BLOCK_SIZE 196608 //size of block (bytes) that is the maximum that miners will produce
|
#define CRYPTONOTE_GETBLOCKTEMPLATE_MAX_BLOCK_SIZE 196608 //size of block (bytes) that is the maximum that miners will produce
|
||||||
#define CRYPTONOTE_MAX_TX_SIZE 1000000000
|
#define CRYPTONOTE_MAX_TX_SIZE 1000000000
|
||||||
#define CRYPTONOTE_PUBLIC_ADDRESS_TEXTBLOB_VER 0
|
#define CRYPTONOTE_PUBLIC_ADDRESS_TEXTBLOB_VER 0
|
||||||
#define CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX 18 // addresses start with "4"
|
|
||||||
#define CRYPTONOTE_TESTNET_ADDRESS_BASE58_PREFIX 19 // addresses start with "5"
|
|
||||||
#define CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW 60
|
#define CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW 60
|
||||||
#define CURRENT_TRANSACTION_VERSION 1
|
#define CURRENT_TRANSACTION_VERSION 1
|
||||||
#define CURRENT_BLOCK_MAJOR_VERSION 1
|
#define CURRENT_BLOCK_MAJOR_VERSION 1
|
||||||
@ -82,10 +83,6 @@
|
|||||||
#define CRYPTONOTE_MEMPOOL_TX_LIVETIME 86400 //seconds, one day
|
#define CRYPTONOTE_MEMPOOL_TX_LIVETIME 86400 //seconds, one day
|
||||||
#define CRYPTONOTE_MEMPOOL_TX_FROM_ALT_BLOCK_LIVETIME 604800 //seconds, one week
|
#define CRYPTONOTE_MEMPOOL_TX_FROM_ALT_BLOCK_LIVETIME 604800 //seconds, one week
|
||||||
|
|
||||||
#define P2P_DEFAULT_PORT 18080
|
|
||||||
#define TESTNET_P2P_DEFAULT_PORT 28080
|
|
||||||
#define RPC_DEFAULT_PORT 18081
|
|
||||||
#define TESTNET_RPC_DEFAULT_PORT 28081
|
|
||||||
#define COMMAND_RPC_GET_BLOCKS_FAST_MAX_COUNT 1000
|
#define COMMAND_RPC_GET_BLOCKS_FAST_MAX_COUNT 1000
|
||||||
|
|
||||||
#define P2P_LOCAL_WHITE_PEERLIST_LIMIT 1000
|
#define P2P_LOCAL_WHITE_PEERLIST_LIMIT 1000
|
||||||
@ -99,22 +96,8 @@
|
|||||||
#define P2P_DEFAULT_PING_CONNECTION_TIMEOUT 2000 //2 seconds
|
#define P2P_DEFAULT_PING_CONNECTION_TIMEOUT 2000 //2 seconds
|
||||||
#define P2P_DEFAULT_INVOKE_TIMEOUT 60*2*1000 //2 minutes
|
#define P2P_DEFAULT_INVOKE_TIMEOUT 60*2*1000 //2 minutes
|
||||||
#define P2P_DEFAULT_HANDSHAKE_INVOKE_TIMEOUT 5000 //5 seconds
|
#define P2P_DEFAULT_HANDSHAKE_INVOKE_TIMEOUT 5000 //5 seconds
|
||||||
#define P2P_STAT_TRUSTED_PUB_KEY "0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
#define TESTNET_P2P_STAT_TRUSTED_PUB_KEY "0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
#define P2P_DEFAULT_WHITELIST_CONNECTIONS_PERCENT 70
|
#define P2P_DEFAULT_WHITELIST_CONNECTIONS_PERCENT 70
|
||||||
|
|
||||||
// reference these in src/p2p/p2p_networks.h
|
|
||||||
#define MAINNET_NETWORK_ID { 0x12 ,0x30, 0xF1, 0x71 , 0x61, 0x04 , 0x41, 0x61, 0x17, 0x31, 0x00, 0x82, 0x16, 0xA1, 0xA1, 0x10 }
|
|
||||||
#define TESTNET_NETWORK_ID { 0x12 ,0x30, 0xF1, 0x71 , 0x61, 0x04 , 0x41, 0x61, 0x17, 0x31, 0x00, 0x82, 0x16, 0xA1, 0xA1, 0x11 }
|
|
||||||
|
|
||||||
// reference these in src/cryptonote_core/cryptonote_format_utils.cpp
|
|
||||||
#define MAINNET_GENESIS_HASH "010a01ff0001ffffffffffff0f029b2e4c0281c0b02e7c53291a94d1d0cbff8883f8024f5142ee494ffbbd08807121013c086a48c15fb637a96991bc6d53caf77068b5ba6eeb3c82357228c49790584a"
|
|
||||||
#define MAINNET_GENESIS_NONCE 10000
|
|
||||||
#define TESTNET_GENESIS_HASH "CHANGEME"
|
|
||||||
#define TESTNET_GENESIS_NONCE CHANGEME
|
|
||||||
|
|
||||||
// remember also to add seed nodes to src/p2p/net_node.inl for the testnet
|
|
||||||
|
|
||||||
#define ALLOW_DEBUG_COMMANDS
|
#define ALLOW_DEBUG_COMMANDS
|
||||||
|
|
||||||
#define CRYPTONOTE_NAME "bitmonero"
|
#define CRYPTONOTE_NAME "bitmonero"
|
||||||
@ -126,3 +109,32 @@
|
|||||||
|
|
||||||
#define THREAD_STACK_SIZE 5 * 1024 * 1024
|
#define THREAD_STACK_SIZE 5 * 1024 * 1024
|
||||||
|
|
||||||
|
// New constants are intended to go here
|
||||||
|
namespace config
|
||||||
|
{
|
||||||
|
uint64_t const DEFAULT_FEE_ATOMIC_XMR_PER_KB = 500; // Just a placeholder! Change me!
|
||||||
|
uint8_t const FEE_CALCULATION_MAX_RETRIES = 10;
|
||||||
|
uint64_t const DEFAULT_DUST_THRESHOLD = 5000000000; // 5 * 10^9
|
||||||
|
std::string const P2P_REMOTE_DEBUG_TRUSTED_PUB_KEY = "0000000000000000000000000000000000000000000000000000000000000000";
|
||||||
|
|
||||||
|
uint64_t const CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX = 18; // addresses start with "4"
|
||||||
|
uint16_t const P2P_DEFAULT_PORT = 18080;
|
||||||
|
uint16_t const RPC_DEFAULT_PORT = 18081;
|
||||||
|
boost::uuids::uuid const NETWORK_ID = { {
|
||||||
|
0x12 ,0x30, 0xF1, 0x71 , 0x61, 0x04 , 0x41, 0x61, 0x17, 0x31, 0x00, 0x82, 0x16, 0xA1, 0xA1, 0x10
|
||||||
|
} }; // Bender's nightmare
|
||||||
|
std::string const GENESIS_TX = "013c01ff0001ffffffffffff03029b2e4c0281c0b02e7c53291a94d1d0cbff8883f8024f5142ee494ffbbd08807121017767aafcde9be00dcfd098715ebcf7f410daebc582fda69d24a28e9d0bc890d1";
|
||||||
|
uint32_t const GENESIS_NONCE = 10000;
|
||||||
|
|
||||||
|
namespace testnet
|
||||||
|
{
|
||||||
|
uint64_t const CRYPTONOTE_ADDRESS_BASE58_PREFIX = 19; // addresses start with "5"
|
||||||
|
uint16_t const P2P_DEFAULT_PORT = 28080;
|
||||||
|
uint16_t const RPC_DEFAULT_PORT = 28081;
|
||||||
|
boost::uuids::uuid const NETWORK_ID = { {
|
||||||
|
0x12 ,0x30, 0xF1, 0x71 , 0x61, 0x04 , 0x41, 0x61, 0x17, 0x31, 0x00, 0x82, 0x16, 0xA1, 0xA1, 0x11
|
||||||
|
} }; // Bender's daydream
|
||||||
|
std::string const GENESIS_TX = "CHANGEME";
|
||||||
|
uint32_t const GENESIS_NONCE = 10001;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -105,7 +105,7 @@ namespace cryptonote {
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
std::string get_account_address_as_str(const account_public_address& adr)
|
std::string get_account_address_as_str(const account_public_address& adr)
|
||||||
{
|
{
|
||||||
return tools::base58::encode_addr(CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX, t_serializable_object_to_blob(adr));
|
return tools::base58::encode_addr(config::CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX, t_serializable_object_to_blob(adr));
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
bool is_coinbase(const transaction& tx)
|
bool is_coinbase(const transaction& tx)
|
||||||
@ -131,9 +131,9 @@ namespace cryptonote {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX != prefix)
|
if (config::CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX != prefix)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L1("Wrong address prefix: " << prefix << ", expected " << CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX);
|
LOG_PRINT_L1("Wrong address prefix: " << prefix << ", expected " << config::CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,8 +672,7 @@ namespace cryptonote
|
|||||||
blobdata txb = tx_to_blob(bl.miner_tx);
|
blobdata txb = tx_to_blob(bl.miner_tx);
|
||||||
std::string hex_tx_represent = string_tools::buff_to_hex_nodelimer(txb);
|
std::string hex_tx_represent = string_tools::buff_to_hex_nodelimer(txb);
|
||||||
|
|
||||||
//hard code coinbase tx in genesis block, because "tru" generating tx use random, but genesis should be always the same
|
std::string genesis_coinbase_tx_hex = config::GENESIS_TX;
|
||||||
std::string genesis_coinbase_tx_hex = "013c01ff0001ffffffffffff03029b2e4c0281c0b02e7c53291a94d1d0cbff8883f8024f5142ee494ffbbd08807121017767aafcde9be00dcfd098715ebcf7f410daebc582fda69d24a28e9d0bc890d1";
|
|
||||||
|
|
||||||
blobdata tx_bl;
|
blobdata tx_bl;
|
||||||
string_tools::parse_hexstr_to_binbuff(genesis_coinbase_tx_hex, tx_bl);
|
string_tools::parse_hexstr_to_binbuff(genesis_coinbase_tx_hex, tx_bl);
|
||||||
@ -682,7 +681,7 @@ namespace cryptonote
|
|||||||
bl.major_version = CURRENT_BLOCK_MAJOR_VERSION;
|
bl.major_version = CURRENT_BLOCK_MAJOR_VERSION;
|
||||||
bl.minor_version = CURRENT_BLOCK_MINOR_VERSION;
|
bl.minor_version = CURRENT_BLOCK_MINOR_VERSION;
|
||||||
bl.timestamp = 0;
|
bl.timestamp = 0;
|
||||||
bl.nonce = 10000;
|
bl.nonce = config::GENESIS_NONCE;
|
||||||
miner::find_nonce_for_given_block(bl, 1, 0);
|
miner::find_nonce_for_given_block(bl, 1, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -42,12 +42,12 @@
|
|||||||
#include <boost/program_options/variables_map.hpp>
|
#include <boost/program_options/variables_map.hpp>
|
||||||
#include <boost/serialization/version.hpp>
|
#include <boost/serialization/version.hpp>
|
||||||
|
|
||||||
|
#include "cryptonote_config.h"
|
||||||
#include "warnings.h"
|
#include "warnings.h"
|
||||||
#include "net/levin_server_cp2.h"
|
#include "net/levin_server_cp2.h"
|
||||||
#include "p2p_protocol_defs.h"
|
#include "p2p_protocol_defs.h"
|
||||||
#include "storages/levin_abstract_invoke2.h"
|
#include "storages/levin_abstract_invoke2.h"
|
||||||
#include "net_peerlist.h"
|
#include "net_peerlist.h"
|
||||||
#include "p2p_networks.h"
|
|
||||||
#include "math_helper.h"
|
#include "math_helper.h"
|
||||||
#include "net_node_common.h"
|
#include "net_node_common.h"
|
||||||
#include "common/command_line.h"
|
#include "common/command_line.h"
|
||||||
@ -79,7 +79,7 @@ namespace nodetool
|
|||||||
public:
|
public:
|
||||||
typedef t_payload_net_handler payload_net_handler;
|
typedef t_payload_net_handler payload_net_handler;
|
||||||
// Some code
|
// Some code
|
||||||
node_server(t_payload_net_handler& payload_handler):m_payload_handler(payload_handler), m_allow_local_ip(false), m_hide_my_port(false), m_network_id(MONERO_NETWORK)
|
node_server(t_payload_net_handler& payload_handler):m_payload_handler(payload_handler), m_allow_local_ip(false), m_hide_my_port(false), m_network_id(::config::NETWORK_ID)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
static void init_options(boost::program_options::options_description& desc);
|
static void init_options(boost::program_options::options_description& desc);
|
||||||
|
@ -60,7 +60,7 @@ namespace nodetool
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
const command_line::arg_descriptor<std::string> arg_p2p_bind_ip = {"p2p-bind-ip", "Interface for p2p network protocol", "0.0.0.0"};
|
const command_line::arg_descriptor<std::string> arg_p2p_bind_ip = {"p2p-bind-ip", "Interface for p2p network protocol", "0.0.0.0"};
|
||||||
const command_line::arg_descriptor<std::string> arg_p2p_bind_port = {"p2p-bind-port", "Port for p2p network protocol", boost::to_string(P2P_DEFAULT_PORT)};
|
const command_line::arg_descriptor<std::string> arg_p2p_bind_port = {"p2p-bind-port", "Port for p2p network protocol", boost::to_string(config::P2P_DEFAULT_PORT)};
|
||||||
const command_line::arg_descriptor<uint32_t> arg_p2p_external_port = {"p2p-external-port", "External port for p2p network protocol (if port forwarding used with NAT)", 0};
|
const command_line::arg_descriptor<uint32_t> arg_p2p_external_port = {"p2p-external-port", "External port for p2p network protocol (if port forwarding used with NAT)", 0};
|
||||||
const command_line::arg_descriptor<bool> arg_p2p_allow_local_ip = {"allow-local-ip", "Allow local ip add to peer list, mostly in debug purposes"};
|
const command_line::arg_descriptor<bool> arg_p2p_allow_local_ip = {"allow-local-ip", "Allow local ip add to peer list, mostly in debug purposes"};
|
||||||
const command_line::arg_descriptor<std::vector<std::string> > arg_p2p_add_peer = {"add-peer", "Manually add peer to local peerlist"};
|
const command_line::arg_descriptor<std::vector<std::string> > arg_p2p_add_peer = {"add-peer", "Manually add peer to local peerlist"};
|
||||||
@ -848,7 +848,7 @@ namespace nodetool
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
crypto::public_key pk = AUTO_VAL_INIT(pk);
|
crypto::public_key pk = AUTO_VAL_INIT(pk);
|
||||||
epee::string_tools::hex_to_pod(P2P_STAT_TRUSTED_PUB_KEY, pk);
|
epee::string_tools::hex_to_pod(::config::P2P_REMOTE_DEBUG_TRUSTED_PUB_KEY, pk);
|
||||||
crypto::hash h = tools::get_proof_of_trust_hash(tr);
|
crypto::hash h = tools::get_proof_of_trust_hash(tr);
|
||||||
if(!crypto::check_signature(h, pk, tr.sign))
|
if(!crypto::check_signature(h, pk, tr.sign))
|
||||||
{
|
{
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
// Copyright (c) 2014, The Monero Project
|
|
||||||
//
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without modification, are
|
|
||||||
// permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
||||||
// conditions and the following disclaimer.
|
|
||||||
//
|
|
||||||
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
||||||
// of conditions and the following disclaimer in the documentation and/or other
|
|
||||||
// materials provided with the distribution.
|
|
||||||
//
|
|
||||||
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
|
||||||
// used to endorse or promote products derived from this software without specific
|
|
||||||
// prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
||||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
||||||
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
||||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
|
||||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
//
|
|
||||||
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
namespace nodetool
|
|
||||||
{
|
|
||||||
const static boost::uuids::uuid MONERO_NETWORK = { { 0x12 ,0x30, 0xF1, 0x71 , 0x61, 0x04 , 0x41, 0x61, 0x17, 0x31, 0x00, 0x82, 0x16, 0xA1, 0xA1, 0x10} }; //Bender's nightmare
|
|
||||||
}
|
|
@ -46,7 +46,7 @@ namespace cryptonote
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
const command_line::arg_descriptor<std::string> arg_rpc_bind_ip = {"rpc-bind-ip", "", "127.0.0.1"};
|
const command_line::arg_descriptor<std::string> arg_rpc_bind_ip = {"rpc-bind-ip", "", "127.0.0.1"};
|
||||||
const command_line::arg_descriptor<std::string> arg_rpc_bind_port = {"rpc-bind-port", "", std::to_string(RPC_DEFAULT_PORT)};
|
const command_line::arg_descriptor<std::string> arg_rpc_bind_port = {"rpc-bind-port", "", std::to_string(config::RPC_DEFAULT_PORT)};
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------
|
||||||
|
@ -331,7 +331,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
|
|||||||
if (m_daemon_host.empty())
|
if (m_daemon_host.empty())
|
||||||
m_daemon_host = "localhost";
|
m_daemon_host = "localhost";
|
||||||
if (!m_daemon_port)
|
if (!m_daemon_port)
|
||||||
m_daemon_port = RPC_DEFAULT_PORT;
|
m_daemon_port = config::RPC_DEFAULT_PORT;
|
||||||
if (m_daemon_address.empty())
|
if (m_daemon_address.empty())
|
||||||
m_daemon_address = std::string("http://") + m_daemon_host + ":" + std::to_string(m_daemon_port);
|
m_daemon_address = std::string("http://") + m_daemon_host + ":" + std::to_string(m_daemon_port);
|
||||||
|
|
||||||
@ -1157,7 +1157,7 @@ int main(int argc, char* argv[])
|
|||||||
if (daemon_host.empty())
|
if (daemon_host.empty())
|
||||||
daemon_host = "localhost";
|
daemon_host = "localhost";
|
||||||
if (!daemon_port)
|
if (!daemon_port)
|
||||||
daemon_port = RPC_DEFAULT_PORT;
|
daemon_port = config::RPC_DEFAULT_PORT;
|
||||||
if (daemon_address.empty())
|
if (daemon_address.empty())
|
||||||
daemon_address = std::string("http://") + daemon_host + ":" + std::to_string(daemon_port);
|
daemon_address = std::string("http://") + daemon_host + ":" + std::to_string(daemon_port);
|
||||||
|
|
||||||
|
@ -543,7 +543,7 @@ bool wallet2::check_connection()
|
|||||||
net_utils::http::url_content u;
|
net_utils::http::url_content u;
|
||||||
net_utils::parse_url(m_daemon_address, u);
|
net_utils::parse_url(m_daemon_address, u);
|
||||||
if(!u.port)
|
if(!u.port)
|
||||||
u.port = RPC_DEFAULT_PORT;
|
u.port = config::RPC_DEFAULT_PORT;
|
||||||
return m_http_client.connect(u.host, std::to_string(u.port), WALLET_RCP_CONNECTION_TIMEOUT);
|
return m_http_client.connect(u.host, std::to_string(u.port), WALLET_RCP_CONNECTION_TIMEOUT);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
@ -104,7 +104,10 @@ int main(int argc, char* argv[])
|
|||||||
//create objects and link them
|
//create objects and link them
|
||||||
tests::proxy_core pr_core;
|
tests::proxy_core pr_core;
|
||||||
cryptonote::t_cryptonote_protocol_handler<tests::proxy_core> cprotocol(pr_core, NULL);
|
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);
|
cprotocol.set_p2p_endpoint(&p2psrv);
|
||||||
//pr_core.set_cryptonote_protocol(&cprotocol);
|
//pr_core.set_cryptonote_protocol(&cprotocol);
|
||||||
//daemon_cmmands_handler dch(p2psrv);
|
//daemon_cmmands_handler dch(p2psrv);
|
||||||
|
@ -37,6 +37,12 @@ using namespace epee;
|
|||||||
#include "wallet/wallet2.h"
|
#include "wallet/wallet2.h"
|
||||||
using namespace cryptonote;
|
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::string generate_random_wallet_name()
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
@ -79,7 +85,7 @@ bool do_send_money(tools::wallet2& w1, tools::wallet2& w2, size_t mix_in_factor,
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
tools::wallet2::pending_tx ptx;
|
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);
|
w1.commit_tx(ptx);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -185,7 +191,7 @@ bool transactions_flow_test(std::string& working_folder,
|
|||||||
BOOST_FOREACH(tools::wallet2::transfer_details& td, incoming_transfers)
|
BOOST_FOREACH(tools::wallet2::transfer_details& td, incoming_transfers)
|
||||||
{
|
{
|
||||||
cryptonote::transaction tx_s;
|
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));
|
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);
|
LOG_PRINT_GREEN("Starter transaction sent " << get_transaction_hash(tx_s), LOG_LEVEL_0);
|
||||||
if(++count >= FIRST_N_TRANSFERS)
|
if(++count >= FIRST_N_TRANSFERS)
|
||||||
@ -213,7 +219,7 @@ bool transactions_flow_test(std::string& working_folder,
|
|||||||
for(i = 0; i != transactions_count; i++)
|
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);
|
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);
|
misc_utils::sleep_no_w(1000);
|
||||||
LOG_PRINT_L0("not enough money, waiting for cashback or mining");
|
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)
|
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;
|
cryptonote::account_public_address addr;
|
||||||
ASSERT_FALSE(cryptonote::get_account_address_from_str(addr, addr_str));
|
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;
|
std::string serialized_keys_copy = test_serialized_keys;
|
||||||
serialized_keys_copy[0] = '\0';
|
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;
|
cryptonote::account_public_address addr;
|
||||||
ASSERT_FALSE(cryptonote::get_account_address_from_str(addr, addr_str));
|
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;
|
std::string serialized_keys_copy = test_serialized_keys;
|
||||||
serialized_keys_copy.back() = '\x01';
|
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;
|
cryptonote::account_public_address addr;
|
||||||
ASSERT_FALSE(cryptonote::get_account_address_from_str(addr, addr_str));
|
ASSERT_FALSE(cryptonote::get_account_address_from_str(addr, addr_str));
|
||||||
|
@ -35,6 +35,10 @@
|
|||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
#include "cryptonote_core/cryptonote_format_utils.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)
|
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;
|
cryptonote::account_base acc;
|
||||||
acc.generate();
|
acc.generate();
|
||||||
cryptonote::blobdata b = "dsdsdfsdfsf";
|
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);
|
crypto::public_key tx_pub_key = cryptonote::get_tx_pub_key_from_extra(tx);
|
||||||
ASSERT_NE(tx_pub_key, cryptonote::null_pkey);
|
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;
|
cryptonote::account_base acc;
|
||||||
acc.generate();
|
acc.generate();
|
||||||
cryptonote::blobdata b(TX_EXTRA_NONCE_MAX_COUNT + 1, 0);
|
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)
|
TEST(parse_and_validate_tx_extra, fails_on_wrong_size_in_extra_nonce)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user