Initial commit

This commit is contained in:
Albert Werner 2014-06-21 17:41:43 +04:00
parent 198323aaf2
commit e399973550
180 changed files with 238 additions and 426 deletions

View file

@ -43,4 +43,6 @@ add_dependencies(simplewallet version)
set_property(TARGET common crypto cryptonote_core rpc wallet PROPERTY FOLDER "libs") set_property(TARGET common crypto cryptonote_core rpc wallet PROPERTY FOLDER "libs")
set_property(TARGET daemon simplewallet connectivity_tool simpleminer PROPERTY FOLDER "prog") set_property(TARGET daemon simplewallet connectivity_tool simpleminer PROPERTY FOLDER "prog")
set_property(TARGET daemon PROPERTY OUTPUT_NAME "bytecoind") #TODO Specify the name of daemon for your currency
#set_property(TARGET daemon PROPERTY OUTPUT_NAME "cryptonoted")

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -8,8 +8,10 @@
#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_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 6 // addresses start with "2" //TODO Define the first letter of your currency address
#define CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW 10 #define CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX
//TODO Choose maturity period for your currency
#define CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW
#define CURRENT_TRANSACTION_VERSION 1 #define CURRENT_TRANSACTION_VERSION 1
#define CURRENT_BLOCK_MAJOR_VERSION 1 #define CURRENT_BLOCK_MAJOR_VERSION 1
#define CURRENT_BLOCK_MINOR_VERSION 0 #define CURRENT_BLOCK_MINOR_VERSION 0
@ -17,22 +19,26 @@
#define BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW 60 #define BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW 60
// MONEY_SUPPLY - total number coins to be generated //TODO Specify total number of available coins
#define MONEY_SUPPLY ((uint64_t)(-1)) //TODO ((uint64_t)(-1)) equals to 18446744073709551616 coins
//TODO or you can define number explicitly UINT64_C(858986905600000000)
#define MONEY_SUPPLY
#define EMISSION_SPEED_FACTOR (18) #define EMISSION_SPEED_FACTOR (18)
#define CRYPTONOTE_REWARD_BLOCKS_WINDOW 100 #define CRYPTONOTE_REWARD_BLOCKS_WINDOW 100
#define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE 10000 //size of block (bytes) after which reward for block calculated using block size #define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE 10000 //size of block (bytes) after which reward for block calculated using block size
#define CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE 600 #define CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE 600
#define CRYPTONOTE_DISPLAY_DECIMAL_POINT 8 #define CRYPTONOTE_DISPLAY_DECIMAL_POINT 8
// COIN - number of smallest units in one coin //TODO Define number of smallest units in one coin
#define COIN ((uint64_t)100000000) // pow(10, 8) #define COIN
#define DEFAULT_FEE ((uint64_t)1000000) // pow(10, 6) //TODO Define default fee for transactions
#define DEFAULT_FEE
//TODO There are options to tune CryptoNote's difficulty retargeting function.
//TODO We recommend not to change it.
#define DIFFICULTY_TARGET 120 // seconds #define DIFFICULTY_TARGET 120 // seconds
#define DIFFICULTY_WINDOW 720 // blocks #define DIFFICULTY_WINDOW 720 // blocks
#define DIFFICULTY_LAG 15 // !!! #define DIFFICULTY_LAG 15
#define DIFFICULTY_CUT 60 // timestamps to cut after sorting #define DIFFICULTY_CUT 60 // timestamps to cut after sorting
#define DIFFICULTY_BLOCKS_COUNT DIFFICULTY_WINDOW + DIFFICULTY_LAG #define DIFFICULTY_BLOCKS_COUNT DIFFICULTY_WINDOW + DIFFICULTY_LAG
@ -41,16 +47,17 @@
#define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS 1 #define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS 1
#define DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN DIFFICULTY_TARGET //just alias #define DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN DIFFICULTY_TARGET
#define BLOCKS_IDS_SYNCHRONIZING_DEFAULT_COUNT 10000 //by default, blocks ids count in synchronizing #define BLOCKS_IDS_SYNCHRONIZING_DEFAULT_COUNT 10000 //by default, blocks ids count in synchronizing
#define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT 200 //by default, blocks count in blocks downloading #define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT 200 //by default, blocks count in blocks downloading
#define CRYPTONOTE_PROTOCOL_HOP_RELAX_COUNT 3 //value of hop, after which we use only announce of new block #define CRYPTONOTE_PROTOCOL_HOP_RELAX_COUNT 3 //value of hop, after which we use only announce of new block
//TODO This port will be used by the daemon to establish connections with p2p network
#define P2P_DEFAULT_PORT 8080 #define P2P_DEFAULT_PORT
#define RPC_DEFAULT_PORT 8081 //TODO This port will be used by the daemon to interact with simlewallet
#define RPC_DEFAULT_PORT
#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
@ -69,10 +76,12 @@
#define ALLOW_DEBUG_COMMANDS #define ALLOW_DEBUG_COMMANDS
#define CRYPTONOTE_NAME "bytecoin" //TODO Put here the name of your currency
#define CRYPTONOTE_NAME
#define CRYPTONOTE_BLOCKS_FILENAME "blocks.dat"
#define CRYPTONOTE_BLOCKINDEXES_FILENAME "blockindexes.dat"
#define CRYPTONOTE_BLOCKSCACHE_FILENAME "blockscache.dat"
#define CRYPTONOTE_POOLDATA_FILENAME "poolstate.bin" #define CRYPTONOTE_POOLDATA_FILENAME "poolstate.bin"
#define CRYPTONOTE_BLOCKCHAINDATA_FILENAME "blockchain.bin"
#define CRYPTONOTE_BLOCKCHAINDATA_TEMP_FILENAME "blockchain.bin.tmp"
#define P2P_NET_DATA_FILENAME "p2pstate.bin" #define P2P_NET_DATA_FILENAME "p2pstate.bin"
#define MINER_CONFIG_FILE_NAME "miner_conf.json" #define MINER_CONFIG_FILE_NAME "miner_conf.json"

View file

@ -1 +1,5 @@
// Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "SwappedMap.h" #include "SwappedMap.h"

View file

@ -1,3 +1,7 @@
// Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#pragma once #pragma once
#include <cstdint> #include <cstdint>

View file

@ -1 +1,5 @@
// Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "SwappedVector.h" #include "SwappedVector.h"

View file

@ -1,3 +1,7 @@
// Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#pragma once #pragma once
#include <cstdint> #include <cstdint>

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

206
src/cryptonote_core/blockchain_storage.cpp Normal file → Executable file
View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -17,18 +17,6 @@
#include "file_io_utils.h" #include "file_io_utils.h"
#include "common/boost_serialization_helper.h" #include "common/boost_serialization_helper.h"
//namespace {
// std::string hashHex(const crypto::hash& hash) {
// std::string result;
// for (size_t i = 0; i < crypto::HASH_SIZE; ++i) {
// result += "0123456789ABCDEF"[static_cast<uint8_t>(hash.data[i]) >> 4];
// result += "0123456789ABCDEF"[static_cast<uint8_t>(hash.data[i]) & 15];
// }
//
// return result;
// }
//}
namespace { namespace {
std::string appendPath(const std::string& path, const std::string& fileName) { std::string appendPath(const std::string& path, const std::string& fileName) {
std::string result = path; std::string result = path;
@ -61,8 +49,6 @@ namespace cryptonote {
uint64_t m_keeper_block_height; uint64_t m_keeper_block_height;
size_t m_blob_size; size_t m_blob_size;
std::vector<uint64_t> m_global_output_indexes; std::vector<uint64_t> m_global_output_indexes;
template<class archive_t> void serialize(archive_t & ar, unsigned int version);
}; };
struct block_extended_info { struct block_extended_info {
@ -71,37 +57,7 @@ namespace cryptonote {
size_t block_cumulative_size; size_t block_cumulative_size;
difficulty_type cumulative_difficulty; difficulty_type cumulative_difficulty;
uint64_t already_generated_coins; uint64_t already_generated_coins;
template<class archive_t> void serialize(archive_t & ar, unsigned int version);
}; };
template<class archive_t> void transaction_chain_entry::serialize(archive_t & ar, unsigned int version) {
ar & tx;
ar & m_keeper_block_height;
ar & m_blob_size;
ar & m_global_output_indexes;
}
template<class archive_t> void block_extended_info::serialize(archive_t & ar, unsigned int version) {
ar & bl;
ar & height;
ar & cumulative_difficulty;
ar & block_cumulative_size;
ar & already_generated_coins;
}
}
template<class Archive> void cryptonote::blockchain_storage::Transaction::serialize(Archive& archive, unsigned int version) {
archive & tx;
}
template<class Archive> void cryptonote::blockchain_storage::Block::serialize(Archive& archive, unsigned int version) {
archive & bl;
archive & height;
archive & block_cumulative_size;
archive & cumulative_difficulty;
archive & already_generated_coins;
archive & transactions;
} }
template<class Archive> void cryptonote::blockchain_storage::TransactionIndex::serialize(Archive& archive, unsigned int version) { template<class Archive> void cryptonote::blockchain_storage::TransactionIndex::serialize(Archive& archive, unsigned int version) {
@ -109,87 +65,6 @@ template<class Archive> void cryptonote::blockchain_storage::TransactionIndex::s
archive & transaction; archive & transaction;
} }
namespace cryptonote {
#define CURRENT_BLOCKCHAIN_STORAGE_ARCHIVE_VER 13
template<class archive_t> void blockchain_storage::serialize(archive_t & ar, const unsigned int version) {
CRITICAL_REGION_LOCAL(m_blockchain_lock);
if (version < 12) {
LOG_PRINT_L0("Detected blockchain of unsupported version, migration is not possible.");
return;
}
LOG_PRINT_L0("Blockchain of previous version detected, migrating. This may take several minutes, please be patient...");
std::vector<block_extended_info> blocks;
ar & blocks;
{
std::unordered_map<crypto::hash, size_t> blocks_index;
ar & blocks_index;
}
std::unordered_map<crypto::hash, transaction_chain_entry> transactions;
ar & transactions;
{
std::unordered_set<crypto::key_image> spent_keys;
ar & spent_keys;
}
{
std::unordered_map<crypto::hash, block_extended_info> alternative_chains;
ar & alternative_chains;
}
{
std::map<uint64_t, std::vector<std::pair<crypto::hash, size_t>>> outputs;
ar & outputs;
}
{
std::unordered_map<crypto::hash, block_extended_info> invalid_blocks;
ar & invalid_blocks;
}
size_t current_block_cumul_sz_limit;
ar & current_block_cumul_sz_limit;
LOG_PRINT_L0("Old blockchain storage:" << ENDL <<
"blocks: " << blocks.size() << ENDL <<
"transactions: " << transactions.size() << ENDL <<
"current_block_cumul_sz_limit: " << current_block_cumul_sz_limit);
Block block;
Transaction transaction;
for (uint32_t b = 0; b < blocks.size(); ++b) {
block.bl = blocks[b].bl;
block.height = b;
block.block_cumulative_size = blocks[b].block_cumulative_size;
block.cumulative_difficulty = blocks[b].cumulative_difficulty;
block.already_generated_coins = blocks[b].already_generated_coins;
block.transactions.resize(1 + blocks[b].bl.tx_hashes.size());
block.transactions[0].tx = blocks[b].bl.miner_tx;
TransactionIndex transactionIndex = { b, 0 };
pushTransaction(block, get_transaction_hash(blocks[b].bl.miner_tx), transactionIndex);
for (uint32_t t = 0; t < blocks[b].bl.tx_hashes.size(); ++t) {
block.transactions[1 + t].tx = transactions[blocks[b].bl.tx_hashes[t]].tx;
transactionIndex.transaction = 1 + t;
pushTransaction(block, blocks[b].bl.tx_hashes[t], transactionIndex);
}
pushBlock(block);
}
update_next_comulative_size_limit();
if (m_current_block_cumul_sz_limit != current_block_cumul_sz_limit) {
LOG_ERROR("Migration was unsuccessful.");
}
}
}
BOOST_CLASS_VERSION(cryptonote::blockchain_storage, CURRENT_BLOCKCHAIN_STORAGE_ARCHIVE_VER)
bool blockchain_storage::have_tx(const crypto::hash &id) { bool blockchain_storage::have_tx(const crypto::hash &id) {
CRITICAL_REGION_LOCAL(m_blockchain_lock); CRITICAL_REGION_LOCAL(m_blockchain_lock);
return m_transactionMap.find(id) != m_transactionMap.end(); return m_transactionMap.find(id) != m_transactionMap.end();
@ -209,19 +84,16 @@ bool blockchain_storage::init(const std::string& config_folder) {
CRITICAL_REGION_LOCAL(m_blockchain_lock); CRITICAL_REGION_LOCAL(m_blockchain_lock);
m_config_folder = config_folder; m_config_folder = config_folder;
LOG_PRINT_L0("Loading blockchain..."); LOG_PRINT_L0("Loading blockchain...");
if (!m_blocks.open(appendPath(config_folder, "blocks.dat"), appendPath(config_folder, "blockindexes.dat"), 1024)) { if (!m_blocks.open(appendPath(config_folder, CRYPTONOTE_BLOCKS_FILENAME), appendPath(config_folder, CRYPTONOTE_BLOCKINDEXES_FILENAME), 1024)) {
return false; return false;
} }
if (m_blocks.empty()) { if (m_blocks.empty()) {
const std::string filename = appendPath(m_config_folder, CRYPTONOTE_BLOCKCHAINDATA_FILENAME); LOG_PRINT_L0("Can't load blockchain storage from file.");
if (!tools::unserialize_obj_from_file(*this, filename)) {
LOG_PRINT_L0("Can't load blockchain storage from file.");
}
} else { } else {
bool rebuild = true; bool rebuild = true;
try { try {
std::ifstream file(appendPath(config_folder, "blockscache.dat"), std::ios::binary); std::ifstream file(appendPath(config_folder, CRYPTONOTE_BLOCKSCACHE_FILENAME), std::ios::binary);
boost::archive::binary_iarchive archive(file); boost::archive::binary_iarchive archive(file);
crypto::hash lastBlockHash; crypto::hash lastBlockHash;
archive & lastBlockHash; archive & lastBlockHash;
@ -282,7 +154,7 @@ bool blockchain_storage::init(const std::string& config_folder) {
bool blockchain_storage::store_blockchain() { bool blockchain_storage::store_blockchain() {
try { try {
std::ofstream file(appendPath(m_config_folder, "blockscache.dat"), std::ios::binary); std::ofstream file(appendPath(m_config_folder, CRYPTONOTE_BLOCKSCACHE_FILENAME), std::ios::binary);
boost::archive::binary_oarchive archive(file); boost::archive::binary_oarchive archive(file);
crypto::hash lastBlockHash = get_block_hash(m_blocks.back().bl); crypto::hash lastBlockHash = get_block_hash(m_blocks.back().bl);
archive & lastBlockHash; archive & lastBlockHash;
@ -290,73 +162,9 @@ bool blockchain_storage::store_blockchain() {
archive & m_transactionMap; archive & m_transactionMap;
archive & m_spent_keys; archive & m_spent_keys;
archive & m_outputs; archive & m_outputs;
LOG_PRINT_L0("Saved blockchain cache.");
} catch (std::exception& e) { } catch (std::exception& e) {
LOG_ERROR("Failed to save blockchain, " << e.what()); LOG_ERROR("Failed to save blockchain cache, " << e.what());
}
//{
// std::ofstream file(appendPath(m_config_folder, "blockscache2.dat"), std::ios::binary);
// crypto::hash lastBlockHash = get_block_hash(m_blocks.back().bl);
// file.write(reinterpret_cast<char*>(&lastBlockHash), sizeof(lastBlockHash));
// uint32_t blockMapSize = m_blockMap.size();
// file.write(reinterpret_cast<char*>(&blockMapSize), sizeof(blockMapSize));
// for (auto& i : m_blockMap) {
// crypto::hash blockHash = i.first;
// file.write(reinterpret_cast<char*>(&blockHash), sizeof(blockHash));
// uint32_t blockIndex = i.second;
// file.write(reinterpret_cast<char*>(&blockIndex), sizeof(blockIndex));
// }
// uint32_t transactionMapSize = m_transactionMap.size();
// file.write(reinterpret_cast<char*>(&transactionMapSize), sizeof(transactionMapSize));
// for (auto& i : m_transactionMap) {
// crypto::hash transactionHash = i.first;
// file.write(reinterpret_cast<char*>(&transactionHash), sizeof(transactionHash));
// uint32_t blockIndex = i.second.block;
// file.write(reinterpret_cast<char*>(&blockIndex), sizeof(blockIndex));
// uint32_t transactionIndex = i.second.transaction;
// file.write(reinterpret_cast<char*>(&transactionIndex), sizeof(transactionIndex));
// }
// uint32_t spentKeysSize = m_spent_keys.size();
// file.write(reinterpret_cast<char*>(&spentKeysSize), sizeof(spentKeysSize));
// for (auto& i : m_spent_keys) {
// crypto::key_image key = i;
// file.write(reinterpret_cast<char*>(&key), sizeof(key));
// }
// uint32_t outputsSize = m_outputs.size();
// file.write(reinterpret_cast<char*>(&outputsSize), sizeof(outputsSize));
// for (auto& i : m_outputs) {
// uint32_t indexesSize = i.second.size();
// file.write(reinterpret_cast<char*>(&indexesSize), sizeof(indexesSize));
// for (auto& j : i.second) {
// uint32_t blockIndex = j.first.block;
// file.write(reinterpret_cast<char*>(&blockIndex), sizeof(blockIndex));
// uint32_t transactionIndex = j.first.transaction;
// file.write(reinterpret_cast<char*>(&transactionIndex), sizeof(transactionIndex));
// uint32_t outputIndex = j.second;
// file.write(reinterpret_cast<char*>(&outputIndex), sizeof(outputIndex));
// }
// }
//}
{
//std::ofstream file(appendPath(m_config_folder, "blockscache3.dat"), std::ios::binary);
//binary_archive<true> archive(file);
//crypto::hash lastBlockHash = get_block_hash(m_blocks.back().bl);
//do_serialize(archive, lastBlockHash);
//do_serialize(archive, m_blockMap);
//do_serialize(archive, m_transactionMap);
//do_serialize(archive, m_spent_keys);
//do_serialize(archive, m_outputs);
} }
return true; return true;

6
src/cryptonote_core/blockchain_storage.h Normal file → Executable file
View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -105,8 +105,6 @@ namespace cryptonote {
transaction tx; transaction tx;
std::vector<uint32_t> m_global_output_indexes; std::vector<uint32_t> m_global_output_indexes;
template<class archive_t> void serialize(archive_t & ar, unsigned int version);
BEGIN_SERIALIZE_OBJECT() BEGIN_SERIALIZE_OBJECT()
FIELD(tx) FIELD(tx)
FIELD(m_global_output_indexes) FIELD(m_global_output_indexes)
@ -121,8 +119,6 @@ namespace cryptonote {
uint64_t already_generated_coins; uint64_t already_generated_coins;
std::vector<Transaction> transactions; std::vector<Transaction> transactions;
template<class Archive> void serialize(Archive& archive, unsigned int version);
BEGIN_SERIALIZE_OBJECT() BEGIN_SERIALIZE_OBJECT()
FIELD(bl) FIELD(bl)
VARINT_FIELD(height) VARINT_FIELD(height)

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -12,22 +12,6 @@
namespace cryptonote { namespace cryptonote {
inline bool create_checkpoints(cryptonote::checkpoints& checkpoints) inline bool create_checkpoints(cryptonote::checkpoints& checkpoints)
{ {
ADD_CHECKPOINT(79000, "cae33204e624faeb64938d80073bb7bbacc27017dc63f36c5c0f313cad455a02");
ADD_CHECKPOINT(140000, "993059fb6ab92db7d80d406c67a52d9c02d873ca34b6290a12b744c970208772");
ADD_CHECKPOINT(200000, "a5f74c7542077df6859f48b5b1f9c3741f29df38f91a47e14c94b5696e6c3073");
ADD_CHECKPOINT(230580, "32bd7cb6c68a599cf2861941f29002a5e203522b9af54f08dfced316f6459103");
ADD_CHECKPOINT(260000, "f68e70b360ca194f48084da7a7fd8e0251bbb4b5587f787ca65a6f5baf3f5947");
ADD_CHECKPOINT(300000, "8e80861713f68354760dc10ea6ea79f5f3ff28f39b3f0835a8637463b09d70ff");
ADD_CHECKPOINT(390285, "e00bdc9bf407aeace2f3109de11889ed25894bf194231d075eddaec838097eb7");
ADD_CHECKPOINT(417000, "2dc96f8fc4d4a4d76b3ed06722829a7ab09d310584b8ecedc9b578b2c458a69f");
ADD_CHECKPOINT(427193, "00feabb08f2d5759ed04fd6b799a7513187478696bba2db2af10d4347134e311");
ADD_CHECKPOINT(453537, "d17de6916c5aa6ffcae575309c80b0f8fdcd0a84b5fa8e41a841897d4b5a4e97");
ADD_CHECKPOINT(462250, "13468d210a5ec884cf839f0259f247ccf3efef0414ac45172033d32c739beb3e");
ADD_CHECKPOINT(468000, "251bcbd398b1f593193a7210934a3d87f692b2cb0c45206150f59683dd7e9ba1");
ADD_CHECKPOINT(480200, "363544ac9920c778b815c2fdbcbca70a0d79b21f662913a42da9b49e859f0e5b");
ADD_CHECKPOINT(484500, "5cdf2101a0a62a0ab2a1ca0c15a6212b21f6dbdc42a0b7c0bcf65ca40b7a14fb");
ADD_CHECKPOINT(506000, "3d54c1132f503d98d3f0d78bb46a4503c1a19447cb348361a2232e241cb45a3c");
return true; return true;
} }
} }

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -622,15 +622,20 @@ namespace cryptonote
//genesis block //genesis block
bl = boost::value_initialized<block>(); bl = boost::value_initialized<block>();
//TODO Uncomment this code block on teh first network lounch. It will generate and print you genesis block's hash.
//TODO Then you must copy it and put to genesis_coinbase_tx_hex variable
/*
account_public_address ac = boost::value_initialized<account_public_address>(); account_public_address ac = boost::value_initialized<account_public_address>();
std::vector<size_t> sz; std::vector<size_t> sz;
construct_miner_tx(0, 0, 0, 0, 0, ac, bl.miner_tx); // zero fee in genesis construct_miner_tx(0, 0, 0, 0, 0, ac, bl.miner_tx); // zero fee in genesis
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);
std::cout << "Genesis block hex: " << hex_to_represent << endl;
*/
//hard code coinbase tx in genesis block, because "tru" generating tx use random, but genesis should be always the same //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 = "010a01ff0001ffffffffffff0f029b2e4c0281c0b02e7c53291a94d1d0cbff8883f8024f5142ee494ffbbd08807121013c086a48c15fb637a96991bc6d53caf77068b5ba6eeb3c82357228c49790584a"; //TODO After you obtain hash of the genesis block put it here and recompile sources!
std::string genesis_coinbase_tx_hex = "";
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);

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -193,16 +193,8 @@ namespace nodetool
template<class t_payload_net_handler> template<class t_payload_net_handler>
bool node_server<t_payload_net_handler>::init(const boost::program_options::variables_map& vm) bool node_server<t_payload_net_handler>::init(const boost::program_options::variables_map& vm)
{ {
ADD_HARDCODED_SEED_NODE("seed.bytecoin.org:8080"); //TODO add seed for your network
ADD_HARDCODED_SEED_NODE("85.25.201.95:8080"); //ADD_HARDCODED_SEED_NODE("your_seed_ip.com:8080");
ADD_HARDCODED_SEED_NODE("85.25.196.145:8080");
ADD_HARDCODED_SEED_NODE("85.25.196.146:8080");
ADD_HARDCODED_SEED_NODE("85.25.196.144:8080");
ADD_HARDCODED_SEED_NODE("5.199.168.138:8080");
ADD_HARDCODED_SEED_NODE("62.75.236.152:8080");
ADD_HARDCODED_SEED_NODE("85.25.194.245:8080");
ADD_HARDCODED_SEED_NODE("95.211.224.160:8080");
ADD_HARDCODED_SEED_NODE("144.76.200.44:8080");
bool res = handle_command_line(vm); bool res = handle_command_line(vm);
CHECK_AND_ASSERT_MES(res, false, "Failed to handle command line"); CHECK_AND_ASSERT_MES(res, false, "Failed to handle command line");
@ -376,7 +368,7 @@ namespace nodetool
return; return;
} }
if(rsp.node_data.network_id != BYTECOIN_NETWORK) if(rsp.node_data.network_id != CRYPTONOTE_NETWORK)
{ {
LOG_ERROR_CCONTEXT("COMMAND_HANDSHAKE Failed, wrong network! (" << epee::string_tools::get_str_from_guid_a(rsp.node_data.network_id) << "), closing connection."); LOG_ERROR_CCONTEXT("COMMAND_HANDSHAKE Failed, wrong network! (" << epee::string_tools::get_str_from_guid_a(rsp.node_data.network_id) << "), closing connection.");
return; return;
@ -784,7 +776,7 @@ namespace nodetool
node_data.my_port = m_external_port ? m_external_port : m_listenning_port; node_data.my_port = m_external_port ? m_external_port : m_listenning_port;
else else
node_data.my_port = 0; node_data.my_port = 0;
node_data.network_id = BYTECOIN_NETWORK; node_data.network_id = CRYPTONOTE_NETWORK;
return true; return true;
} }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
@ -1004,7 +996,7 @@ namespace nodetool
template<class t_payload_net_handler> template<class t_payload_net_handler>
int node_server<t_payload_net_handler>::handle_handshake(int command, typename COMMAND_HANDSHAKE::request& arg, typename COMMAND_HANDSHAKE::response& rsp, p2p_connection_context& context) int node_server<t_payload_net_handler>::handle_handshake(int command, typename COMMAND_HANDSHAKE::request& arg, typename COMMAND_HANDSHAKE::response& rsp, p2p_connection_context& context)
{ {
if(arg.node_data.network_id != BYTECOIN_NETWORK) if(arg.node_data.network_id != CRYPTONOTE_NETWORK)
{ {
LOG_PRINT_CCONTEXT_L0("WRONG NETWORK AGENT CONNECTED! id=" << epee::string_tools::get_str_from_guid_a(arg.node_data.network_id)); LOG_PRINT_CCONTEXT_L0("WRONG NETWORK AGENT CONNECTED! id=" << epee::string_tools::get_str_from_guid_a(arg.node_data.network_id));

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -6,5 +6,5 @@
namespace nodetool namespace nodetool
{ {
const static boost::uuids::uuid BYTECOIN_NETWORK = { { 0x11 ,0x10, 0x01, 0x11 , 0x11, 0x00 , 0x01, 0x01, 0x10, 0x11, 0x00, 0x12, 0x10, 0x11, 0x01, 0x10} }; //Bender's nightmare const static boost::uuids::uuid CRYPTONOTE_NETWORK = { { 0x11 ,0x10, 0x01, 0x11 , 0x11, 0x00 , 0x01, 0x01, 0x10, 0x11, 0x00, 0x12, 0x10, 0x11, 0x01, 0x10} };
} }

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

View file

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 The Cryptonote developers // Copyright (c) 2011-2014 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.

Some files were not shown because too many files have changed in this diff Show more