Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some correction in order to get rid of old NodeNet and its miners #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ else()
else()
set(ARCH_FLAG "-march=${ARCH}")
endif()
set(WARNINGS "-Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Werror -Wno-error=extra -Wno-error=unused-function -Wno-error=deprecated-declarations -Wno-error=sign-compare -Wno-error=strict-aliasing -Wno-error=type-limits -Wno-unused-parameter -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized -Wno-error=unused-result")
set(WARNINGS "-Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Werror -Wno-error=extra -Wno-error=unused-function -Wno-error=deprecated-declarations -Wno-error=sign-compare -Wno-error=strict-aliasing -Wno-error=type-limits -Wno-unused-parameter -Wno-strict-prototypes -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized -Wno-error=unused-result")
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(WARNINGS "${WARNINGS} -Wno-error=mismatched-tags -Wno-error=null-conversion -Wno-overloaded-shift-op-parentheses -Wno-error=shift-count-overflow -Wno-error=tautological-constant-out-of-range-compare -Wno-error=unused-private-field -Wno-error=unneeded-internal-declaration -Wno-error=unused-function")
else()
Expand All @@ -69,7 +69,7 @@ else()
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1))
set(WARNINGS "${WARNINGS} -Wno-error=odr")
endif()
set(C_WARNINGS "-Waggregate-return -Wnested-externs -Wold-style-definition -Wstrict-prototypes")
set(C_WARNINGS "-Waggregate-return -Wnested-externs -Wold-style-definition -Wno-strict-prototypes")
set(CXX_WARNINGS "-Wno-reorder -Wno-missing-field-initializers")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 ${MINGW_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} -maes")
if(NOT APPLE)
Expand Down
2,372 changes: 2,372 additions & 0 deletions CMakeLists.txt.user

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ set_property(TARGET upnpc-static gtest gtest_main PROPERTY FOLDER "external")
if(MSVC)
set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267")
elseif(NOT MSVC)
set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value")
set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value -Wno-strict-prototypes")
endif()
2 changes: 1 addition & 1 deletion external/google/sparse_hash_set
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
//
// See /usr/(local/)?doc/sparsehash-*/sparse_hash_set.html
// for information about how to use this class.

#pragma once
#ifndef _SPARSE_HASH_SET_H_
#define _SPARSE_HASH_SET_H_

Expand Down
2 changes: 1 addition & 1 deletion external/google/sparsehash/sparsehashtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
//
// The value type is required to be copy constructible and default
// constructible, but it need not be (and commonly isn't) assignable.

#pragma once
#ifndef _SPARSEHASHTABLE_H_
#define _SPARSEHASHTABLE_H_

Expand Down
9 changes: 6 additions & 3 deletions src/CryptoNoteConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ const size_t DIFFICULTY_CUT = 30; // timestamp
const size_t DIFFICULTY_LAG = 15; // not used in LWMA-2
static_assert(2 * DIFFICULTY_CUT <= DIFFICULTY_WINDOW - 2, "Bad DIFFICULTY_WINDOW or DIFFICULTY_CUT");

const uint64_t DEPOSIT_MIN_AMOUNT = 150 * COIN;
const uint64_t DEPOSIT_MIN_AMOUNT = 7000000000 * COIN;
// disable staking on old chain
const uint32_t DEPOSIT_MIN_TERM = 11000;
const uint32_t DEPOSIT_MAX_TERM = 10 * 12 * 11000;
const uint64_t DEPOSIT_MIN_TOTAL_RATE_FACTOR = 77000;
Expand Down Expand Up @@ -114,8 +115,8 @@ const uint8_t BLOCK_MINOR_VERSION_1 = 1;
const size_t BLOCKS_IDS_SYNCHRONIZING_DEFAULT_COUNT = 10000; //by default, blocks ids count in synchronizing
const size_t BLOCKS_SYNCHRONIZING_DEFAULT_COUNT = 128; //by default, blocks count in blocks downloading
const size_t COMMAND_RPC_GET_BLOCKS_FAST_MAX_COUNT = 1000;

const int P2P_DEFAULT_PORT = 42080;
// change binding port
const int P2P_DEFAULT_PORT = 42090;
const int RPC_DEFAULT_PORT = 42081;

const size_t P2P_LOCAL_WHITE_PEERLIST_LIMIT = 1000;
Expand All @@ -133,6 +134,7 @@ const uint64_t P2P_DEFAULT_INVOKE_TIMEOUT = 60 * 2 * 1000; //
const size_t P2P_DEFAULT_HANDSHAKE_INVOKE_TIMEOUT = 5000; // 5 seconds
const char P2P_STAT_TRUSTED_PUB_KEY[] = "85ae8734f90bc1ee295ceb0ec05a49852d4dbbc9d1c27a619b5f4bdf26a0196e";

// change binding port
const std::initializer_list<const char*> SEED_NODES = {
"199.175.54.187:42080",
"seed2.digitalnote.biz:42080",
Expand Down Expand Up @@ -201,4 +203,5 @@ const std::map<const uint32_t, const uint8_t> Version = {

} // CryptoNote

//no dangerous command
#define ALLOW_DEBUG_COMMANDS
13 changes: 9 additions & 4 deletions src/CryptoNoteCore/Blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ difficulty_type Blockchain::get_next_difficulty_for_alternative_chain(const std:
std::vector<uint64_t> timestamps;
std::vector<difficulty_type> commulative_difficulties;
uint8_t version = getForkVersion();
size_t difficultyBlocksCount;
size_t difficultyBlocksCount = 0;
auto height = getCurrentBlockchainHeight();

if (version == 0) {
Expand Down Expand Up @@ -1787,9 +1787,14 @@ bool Blockchain::getBlockCumulativeSize(const Block& block, size_t& cumulativeSi
// Precondition: m_blockchain_lock is locked.
bool Blockchain::update_next_comulative_size_limit() {
size_t blockGrantedFullRewardZone =
get_block_major_version_for_height(getCurrentBlockchainHeight()) < parameters::UPGRADE_HEIGHT_V4 ?
parameters::CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1 :
m_currency.blockGrantedFullRewardZone();
/* get_block_major_version_for_height(getCurrentBlockchainHeight()) < parameters::UPGRADE_HEIGHT_V4 ?
that was the bug limitin Tx size. Compared Block number to zone number. That was always true
Try rewrting to: */
getCurrentBlockchainHeight() < parameters::UPGRADE_HEIGHT_V4 ?
// that' should work, or I hope so.

parameters::CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1 :
m_currency.blockGrantedFullRewardZone();

std::vector<size_t> sz;
get_last_n_blocks_sizes(sz, m_currency.rewardBlocksWindow());
Expand Down
1 change: 1 addition & 0 deletions src/CryptoNoteCore/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "CryptoNoteCore/BlockchainMessages.h"

#include <Logging/LoggerMessage.h>
#include <vector>

namespace CryptoNote {

Expand Down
Binary file added src/P2p/IP2pNodeInternal.cpp.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions src/P2p/LevinProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
using namespace CryptoNote;

namespace {

const uint64_t LEVIN_SIGNATURE = 0x0101010101012101LL; //Bender's nightmare
// change Levini signature to avoid connection on old chain
const uint64_t LEVIN_SIGNATURE = 0x0101010101112101LL; //Bender's nightmare
const uint32_t LEVIN_PACKET_REQUEST = 0x00000001;
const uint32_t LEVIN_PACKET_RESPONSE = 0x00000002;
const uint32_t LEVIN_DEFAULT_MAX_PACKET_SIZE = 100000000; //100MB by default
Expand Down
2 changes: 1 addition & 1 deletion src/P2p/LevinProtocol.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2011-2016 The Cryptonote developers
// Copyright (c) 2011-2016 The Cryptonote developers
// Copyright (c) 2014-2017 XDN-project developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
Expand Down
4 changes: 2 additions & 2 deletions src/P2p/NetNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,11 +727,11 @@ namespace CryptoNote
handshakeContext.interrupt();
logger(DEBUGGING) << "Handshake with " << na << " timed out, interrupt it";
});

/*
if (!handshakeContext.get()) {
logger(WARNING) << "Failed to HANDSHAKE with peer " << na;
return false;
}
} */
} catch (System::InterruptedException&) {
logger(DEBUGGING) << "Handshake timed out";
return false;
Expand Down
3 changes: 3 additions & 0 deletions src/P2p/P2pNetworks.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

#pragma once

#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>

namespace CryptoNote
{
const static boost::uuids::uuid CRYPTONOTE_NETWORK = { { 0x4B, 0x4F, 0x32, 0x66, 0x75, 0x20, 0x74, 0x6B, 0x20, 0x69, 0x70, 0x69, 0x75, 0x6D, 0x45, 0x20 } };
Expand Down
1 change: 1 addition & 0 deletions src/Rpc/HttpServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.


#include "HttpServer.h"
#include <boost/scope_exit.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/System/InterruptedException.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

#include "InterruptedException.h"

namespace {
namespace System {
char suppressMSVCWarningLNK4221;
}