2019-04-12 06:36:43 +02:00
// Copyright (c) 2014-2019, The Monero Project
2014-07-23 15:03:52 +02:00
//
// 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
2014-03-03 23:07:58 +01:00
# pragma once
2018-10-09 14:33:39 +02:00
# include <stdexcept>
2014-09-05 04:14:36 +02:00
# include <string>
2020-07-21 22:40:17 +02:00
# include <string_view>
2014-09-05 04:14:36 +02:00
# include <boost/uuid/uuid.hpp>
2018-09-16 06:27:13 +02:00
# include <stdexcept>
2019-06-07 09:03:11 +02:00
# include <chrono>
2020-07-21 22:40:17 +02:00
# include <array>
Add overstaking prevention (#1210)
This prevents staking transactions from being accepted if they overstake
the available contribution room by more than 1%. This is to prevent a
case that has happened a few times where there are competing partial
stakes submitted for the same SN at the same time (i.e. before a block
gets mined with the stakes). For example:
- Operator registers service node with 30% contribution
- Staker 1 submits stake with 40% contribution
- Staker 2 submits stake with 60% contribution
The wallet avoids stake 2 if the 40% has been accepted into a block, but
doesn't if it is still in the mempool. Later, when the contributions
get mined, both stakes are admitted because whichever one goes first
doesn't complete the stake, and the second one is still valid (since
there is a spot, and since it contributes >= the required amount).
Whichever stake gets added to a block second, however, will only be
counted as a contribution of the available amount. So, for example, if
stake 1 gets added first and then stake 2 gets added you'll end up with
an active service node of:
- operator has 30% contributed and locked
- staker 1 has 40% contributed and locked
- staker 2 has 30% contributed but 60% locked.
This commit adds an upper bound for an acceptable stake that is 101% of
the available contribution room so that, in the above situation,
whichever stake gets added first will be a contribution and the second
one will fall through as an ordinary transaction back to the staker's
wallet so that the staker the re-contribute the proper amount.
2020-08-03 02:10:40 +02:00
# include <ratio>
2014-09-05 04:14:36 +02:00
2020-09-02 07:13:12 +02:00
using namespace std : : literals ;
2014-04-02 18:00:17 +02:00
# define CRYPTONOTE_MAX_BLOCK_NUMBER 500000000
2019-04-04 02:15:57 +02:00
# define CRYPTONOTE_MAX_TX_SIZE 1000000
# define CRYPTONOTE_MAX_TX_PER_BLOCK 0x10000000
2014-04-02 18:00:17 +02:00
# define CRYPTONOTE_PUBLIC_ADDRESS_TEXTBLOB_VER 0
2018-04-30 02:21:23 +02:00
# define CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW 30
2018-04-15 19:01:18 +02:00
# define CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT_V2 60*10
2015-10-25 17:16:59 +01:00
# define CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE 10
2019-01-10 00:35:54 +01:00
# define CRYPTONOTE_DEFAULT_TX_MIXIN 9
2018-10-09 10:59:21 +02:00
Service Node Deregister Part 5 (#89)
* Retrieve quorum list from height, reviewed
* Setup data structures for de/register TX
* Submit and validate partial/full deregisters
* Add P2P relaying of partial deregistration votes
* Code review adjustments for deregistration part 1
- Fix check_tx_semantic
- Remove signature_pod as votes are now stored as blobs. Serialization
overrides don't intefere with crypto::signature anymore.
* deregistration_vote_pool - changed sign/verify interface and removed repeated code
* Misc review, fix sign/verify api, vote threshold
* Deregister/tx edge case handling for combinatoric votes
* core, service_node_list: separated address from service node pubkey
* Retrieve quorum list from height, reviewed
* Setup data structures for de/register TX
* Submit and validate partial/full deregisters
* Add P2P relaying of partial deregistration votes
* Code review adjustments for deregistration part 1
- Fix check_tx_semantic
- Remove signature_pod as votes are now stored as blobs. Serialization
overrides don't intefere with crypto::signature anymore.
* deregistration_vote_pool - changed sign/verify interface and removed repeated code
* Misc review, fix sign/verify api, vote threshold
* Deregister/tx edge case handling for combinatoric votes
* Store service node lists for the duration of deregister lifetimes
* Quorum min/max bug, sort node list, fix node to test list
* Change quorum to store acc pub address, fix oob bug
* Code review for expiring votes, acc keys to pub_key, improve err msgs
* Add early out for is_deregistration_tx and protect against quorum changes
* Remove debug code, fix segfault
* Remove irrelevant check for tx v3 in blockchain, fix >= height for pruning quorum states
Incorrect assumption that a transaction can be kept in the chain if it could
eventually become invalid, because if it were the chain would be split and
eventually these transaction would be dropped. But also that we should not
override the pre-existing logic which handles this case anyway.
2018-07-18 04:42:47 +02:00
# define STAKING_REQUIREMENT_LOCK_BLOCKS_EXCESS 20
2018-08-18 06:36:16 +02:00
# define STAKING_PORTIONS UINT64_C(0xfffffffffffffffc)
2018-08-06 15:08:44 +02:00
# define MAX_NUMBER_OF_CONTRIBUTORS 4
# define MIN_PORTIONS (STAKING_PORTIONS / MAX_NUMBER_OF_CONTRIBUTORS)
2018-06-29 06:47:00 +02:00
2020-02-18 21:47:05 +01:00
static_assert ( STAKING_PORTIONS % 12 = = 0 , " Use a multiple of twelve, so that it divides evenly by two, three, or four contributors. " ) ;
2018-08-07 07:45:47 +02:00
2018-08-16 07:14:28 +02:00
# define STAKING_AUTHORIZATION_EXPIRATION_WINDOW (60*60*24*7*2) // 2 weeks
2018-07-21 03:27:13 +02:00
2018-04-29 07:08:46 +02:00
# define BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW 11
2014-03-03 23:07:58 +01:00
2014-04-02 18:00:17 +02:00
# define CRYPTONOTE_REWARD_BLOCKS_WINDOW 100
2021-01-04 01:09:45 +01:00
# define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1 20000 // NOTE(oxen): For testing suite, //size of block (bytes) after which reward for block calculated using block size - before first fork
2017-03-14 20:28:38 +01:00
# define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5 300000 //size of block (bytes) after which reward for block calculated using block size - second change, from v5
2019-01-21 18:18:50 +01:00
# define CRYPTONOTE_LONG_TERM_BLOCK_WEIGHT_WINDOW_SIZE 100000 // size in blocks of the long term block weight median window
# define CRYPTONOTE_SHORT_TERM_BLOCK_WEIGHT_SURGE_FACTOR 50
2014-04-02 18:00:17 +02:00
# define CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE 600
2018-02-28 14:50:21 +01:00
# define CRYPTONOTE_DISPLAY_DECIMAL_POINT 9
2014-11-09 11:53:29 +01:00
2021-04-13 06:50:44 +02:00
# define FEE_PER_BYTE_V12 ((uint64_t)17200) // Higher fee in v12 (only, v13 switches back)
# define FEE_PER_BYTE_V13 ((uint64_t)215) // Fallback used in wallet if no fee is available from RPC
# define FEE_PER_OUTPUT_V13 ((uint64_t)20000000) // 0.02 OXEN per tx output (in addition to the per-byte fee), starting in v13
# define FEE_PER_OUTPUT_V18 ((uint64_t)5000000) // 0.005 OXEN per tx output (in addition to the per-byte fee), starting in v18
2016-10-28 00:43:44 +02:00
# define DYNAMIC_FEE_PER_KB_BASE_BLOCK_REWARD ((uint64_t)10000000000000) // 10 * pow(10,12)
2019-08-23 02:32:34 +02:00
# define DYNAMIC_FEE_PER_KB_BASE_FEE_V5 ((uint64_t)400000000)
2019-06-25 11:22:43 +02:00
# define DYNAMIC_FEE_REFERENCE_TRANSACTION_WEIGHT ((uint64_t)3000)
2019-08-26 19:35:26 +02:00
# define DYNAMIC_FEE_REFERENCE_TRANSACTION_WEIGHT_V12 ((uint64_t)240000) // Only v12 (v13 switches back)
2014-03-03 23:07:58 +01:00
2020-08-07 01:44:23 +02:00
constexpr auto TARGET_BLOCK_TIME = 2 min ;
2020-09-15 08:14:24 +02:00
constexpr uint64_t DIFFICULTY_WINDOW = 59 ;
2020-08-31 09:45:33 +02:00
constexpr uint64_t DIFFICULTY_BLOCKS_COUNT ( bool before_hf16 )
{
2020-09-15 08:14:24 +02:00
// NOTE: We used to have a different setup here where,
// DIFFICULTY_WINDOW = 60
// DIFFICULTY_BLOCKS_COUNT = 61
// next_difficulty_v2's N = DIFFICULTY_WINDOW - 1
2020-08-31 09:45:33 +02:00
//
2020-09-15 08:14:24 +02:00
// And we resized timestamps/difficulties to (N+1) (chopping off the latest timestamp).
2020-08-31 09:45:33 +02:00
//
2020-09-15 08:14:24 +02:00
// Now we re-adjust DIFFICULTY_WINDOW to 59. To preserve the old behaviour we
// add +2. After HF16 we avoid trimming the top block and just add +1.
2020-08-31 09:45:33 +02:00
//
2020-09-15 08:14:24 +02:00
// Ideally, we just set DIFFICULTY_BLOCKS_COUNT to DIFFICULTY_WINDOW
// + 1 for before and after HF16 (having one unified constant) but this
// requires some more investigation to get it working with pre HF16 blocks and
// alt chain code without bugs.
uint64_t result = ( before_hf16 ) ? DIFFICULTY_WINDOW + 2 : DIFFICULTY_WINDOW + 1 ;
2020-08-31 09:45:33 +02:00
return result ;
}
2014-03-03 23:07:58 +01:00
2020-08-18 05:20:22 +02:00
constexpr uint64_t BLOCKS_EXPECTED_IN_HOURS ( int hours ) { return ( 1 h / TARGET_BLOCK_TIME ) * hours ; }
2020-08-07 01:44:23 +02:00
constexpr uint64_t BLOCKS_EXPECTED_IN_DAYS ( int days ) { return BLOCKS_EXPECTED_IN_HOURS ( 24 ) * days ; }
constexpr uint64_t BLOCKS_EXPECTED_IN_YEARS ( int years ) { return BLOCKS_EXPECTED_IN_DAYS ( 365 ) * years ; }
2014-03-03 23:07:58 +01:00
2020-08-07 01:44:23 +02:00
# define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V2 TARGET_BLOCK_TIME * CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS
2014-04-02 18:00:17 +02:00
# define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS 1
2014-03-03 23:07:58 +01:00
# define BLOCKS_IDS_SYNCHRONIZING_DEFAULT_COUNT 10000 //by default, blocks ids count in synchronizing
2019-08-23 02:32:34 +02:00
# define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT 100 //by default, blocks count in blocks downloading
2019-04-23 21:32:27 +02:00
# define BLOCKS_SYNCHRONIZING_MAX_COUNT 2048 //must be a power of 2, greater than 128, equal to SEEDHASH_EPOCH_BLOCKS
2014-03-03 23:07:58 +01:00
2018-01-31 22:53:34 +01:00
# define CRYPTONOTE_MEMPOOL_TX_LIVETIME (86400*3) //seconds, three days
2019-08-23 02:32:34 +02:00
# define CRYPTONOTE_MEMPOOL_TX_FROM_ALT_BLOCK_LIVETIME (86400*7) //seconds, one week
2014-03-03 23:07:58 +01:00
2019-01-25 04:15:52 +01:00
# define MEMPOOL_PRUNE_NON_STANDARD_TX_LIFETIME (2 * 60 * 60) // seconds, 2 hours
2019-05-16 22:34:22 +02:00
// see src/cryptonote_protocol/levin_notify.cpp
# define CRYPTONOTE_NOISE_MIN_EPOCH 5 // minutes
# define CRYPTONOTE_NOISE_EPOCH_RANGE 30 // seconds
# define CRYPTONOTE_NOISE_MIN_DELAY 10 // seconds
# define CRYPTONOTE_NOISE_DELAY_RANGE 5 // seconds
# define CRYPTONOTE_NOISE_BYTES 3*1024 // 3 KiB
# define CRYPTONOTE_NOISE_CHANNELS 2 // Max outgoing connections per zone used for noise/covert sending
# define CRYPTONOTE_MAX_FRAGMENTS 20 // ~20 * NOISE_BYTES max payload size for covert/noise send
2018-08-21 09:01:19 +02:00
2014-03-03 23:07:58 +01:00
# define P2P_LOCAL_WHITE_PEERLIST_LIMIT 1000
# define P2P_LOCAL_GRAY_PEERLIST_LIMIT 5000
2019-08-13 07:04:20 +02:00
# define P2P_DEFAULT_CONNECTIONS_COUNT_OUT 8
# define P2P_DEFAULT_CONNECTIONS_COUNT_IN 32
2014-03-03 23:07:58 +01:00
# define P2P_DEFAULT_HANDSHAKE_INTERVAL 60 //secondes
# define P2P_DEFAULT_PACKET_MAX_SIZE 50000000 //50000000 bytes maximum packet size
# define P2P_DEFAULT_PEERS_IN_HANDSHAKE 250
# define P2P_DEFAULT_CONNECTION_TIMEOUT 5000 //5 seconds
2019-01-21 17:50:03 +01:00
# define P2P_DEFAULT_SOCKS_CONNECT_TIMEOUT 45 // seconds
2014-03-03 23:07:58 +01:00
# define P2P_DEFAULT_PING_CONNECTION_TIMEOUT 2000 //2 seconds
2014-04-07 17:02:15 +02:00
# define P2P_DEFAULT_INVOKE_TIMEOUT 60*2*1000 //2 minutes
2014-03-03 23:07:58 +01:00
# define P2P_DEFAULT_HANDSHAKE_INVOKE_TIMEOUT 5000 //5 seconds
# define P2P_DEFAULT_WHITELIST_CONNECTIONS_PERCENT 70
2017-02-09 01:11:58 +01:00
# define P2P_DEFAULT_ANCHOR_CONNECTIONS_COUNT 2
2019-02-26 13:40:40 +01:00
# define P2P_DEFAULT_SYNC_SEARCH_CONNECTIONS_COUNT 2
2018-10-31 22:47:20 +01:00
# define P2P_DEFAULT_LIMIT_RATE_UP 2048 // kB/s
# define P2P_DEFAULT_LIMIT_RATE_DOWN 8192 // kB/s
2014-03-03 23:07:58 +01:00
2015-11-23 18:34:55 +01:00
# define P2P_FAILED_ADDR_FORGET_SECONDS (60*60) //1 hour
# define P2P_IP_BLOCKTIME (60*60*24) //24 hour
# define P2P_IP_FAILS_BEFORE_BLOCK 10
# define P2P_IDLE_CONNECTION_KILL_INTERVAL (5*60) //5 minutes
2019-06-04 04:28:56 +02:00
// TODO(doyle): Deprecate after checkpointing hardfork, remove notion of being
// able to sync non-fluffy blocks, keep here so we can still accept blocks
// pre-hardfork
2016-10-26 21:00:08 +02:00
# define P2P_SUPPORT_FLAG_FLUFFY_BLOCKS 0x01
# define P2P_SUPPORT_FLAGS P2P_SUPPORT_FLAG_FLUFFY_BLOCKS
2021-01-04 01:09:45 +01:00
# define CRYPTONOTE_NAME "oxen"
2014-03-03 23:07:58 +01:00
# define CRYPTONOTE_POOLDATA_FILENAME "poolstate.bin"
2017-01-28 15:55:14 +01:00
# define CRYPTONOTE_BLOCKCHAINDATA_FILENAME "data.mdb"
# define CRYPTONOTE_BLOCKCHAINDATA_LOCK_FILENAME "lock.mdb"
2014-03-03 23:07:58 +01:00
# define P2P_NET_DATA_FILENAME "p2pstate.bin"
# define MINER_CONFIG_FILE_NAME "miner_conf.json"
2014-04-30 22:50:06 +02:00
# define THREAD_STACK_SIZE 5 * 1024 * 1024
2014-03-03 23:07:58 +01:00
2019-01-30 03:05:20 +01:00
# define HF_VERSION_PER_BYTE_FEE cryptonote::network_version_10_bulletproofs
2019-02-25 08:05:20 +01:00
# define HF_VERSION_SMALLER_BP cryptonote::network_version_11_infinite_staking
# define HF_VERSION_LONG_TERM_BLOCK_WEIGHT cryptonote::network_version_11_infinite_staking
2019-06-25 11:22:43 +02:00
# define HF_VERSION_INCREASE_FEE cryptonote::network_version_12_checkpointing
2019-09-10 02:04:44 +02:00
# define HF_VERSION_PER_OUTPUT_FEE cryptonote::network_version_13_enforce_checkpoints
2019-10-07 19:23:16 +02:00
# define HF_VERSION_ED25519_KEY cryptonote::network_version_13_enforce_checkpoints
2020-01-21 07:16:08 +01:00
# define HF_VERSION_FEE_BURNING cryptonote::network_version_14_blink
# define HF_VERSION_BLINK cryptonote::network_version_14_blink
2020-09-18 21:39:50 +02:00
# define HF_VERSION_MIN_2_OUTPUTS cryptonote::network_version_16_pulse
# define HF_VERSION_REJECT_SIGS_IN_COINBASE cryptonote::network_version_16_pulse
# define HF_VERSION_ENFORCE_MIN_AGE cryptonote::network_version_16_pulse
# define HF_VERSION_EFFECTIVE_SHORT_TERM_MEDIAN_IN_PENALTY cryptonote::network_version_16_pulse
# define HF_VERSION_PULSE cryptonote::network_version_16_pulse
2020-09-18 22:33:26 +02:00
# define HF_VERSION_CLSAG cryptonote::network_version_16_pulse
2021-03-25 01:17:58 +01:00
# define HF_VERSION_PROOF_BTENC cryptonote::network_version_18
2017-03-14 20:28:38 +01:00
2017-03-04 00:31:38 +01:00
# define PER_KB_FEE_QUANTIZATION_DECIMALS 8
2016-10-28 00:43:44 +02:00
2017-09-13 22:03:04 +02:00
# define HASH_OF_HASHES_STEP 256
2018-07-18 23:24:53 +02:00
# define DEFAULT_TXPOOL_MAX_WEIGHT 648000000ull // 3 days at 300000, in bytes
2017-09-13 22:03:04 +02:00
2018-03-30 21:44:51 +02:00
# define BULLETPROOF_MAX_OUTPUTS 16
Pruning
The blockchain prunes seven eighths of prunable tx data.
This saves about two thirds of the blockchain size, while
keeping the node useful as a sync source for an eighth
of the blockchain.
No other data is currently pruned.
There are three ways to prune a blockchain:
- run monerod with --prune-blockchain
- run "prune_blockchain" in the monerod console
- run the monero-blockchain-prune utility
The first two will prune in place. Due to how LMDB works, this
will not reduce the blockchain size on disk. Instead, it will
mark parts of the file as free, so that future data will use
that free space, causing the file to not grow until free space
grows scarce.
The third way will create a second database, a pruned copy of
the original one. Since this is a new file, this one will be
smaller than the original one.
Once the database is pruned, it will stay pruned as it syncs.
That is, there is no need to use --prune-blockchain again, etc.
2018-04-30 00:30:51 +02:00
# define CRYPTONOTE_PRUNING_STRIPE_SIZE 4096 // the smaller, the smoother the increase
# define CRYPTONOTE_PRUNING_LOG_STRIPES 3 // the higher, the more space saved
# define CRYPTONOTE_PRUNING_TIP_BLOCKS 5500 // the smaller, the more space saved
//#define CRYPTONOTE_PRUNING_DEBUG_SPOOF_SEED
2014-09-05 04:14:36 +02:00
// New constants are intended to go here
namespace config
{
2020-07-21 22:40:17 +02:00
inline constexpr auto DNS_TIMEOUT = 20 s ;
inline constexpr uint64_t DEFAULT_FEE_ATOMIC_XMR_PER_KB = 500 ; // Just a placeholder! Change me!
inline constexpr uint8_t FEE_CALCULATION_MAX_RETRIES = 10 ;
inline constexpr uint64_t DEFAULT_DUST_THRESHOLD = 2000000000 ; // 2 * pow(10, 9)
inline constexpr uint64_t BASE_REWARD_CLAMP_THRESHOLD = 100000000 ; // pow(10, 8)
Add overstaking prevention (#1210)
This prevents staking transactions from being accepted if they overstake
the available contribution room by more than 1%. This is to prevent a
case that has happened a few times where there are competing partial
stakes submitted for the same SN at the same time (i.e. before a block
gets mined with the stakes). For example:
- Operator registers service node with 30% contribution
- Staker 1 submits stake with 40% contribution
- Staker 2 submits stake with 60% contribution
The wallet avoids stake 2 if the 40% has been accepted into a block, but
doesn't if it is still in the mempool. Later, when the contributions
get mined, both stakes are admitted because whichever one goes first
doesn't complete the stake, and the second one is still valid (since
there is a spot, and since it contributes >= the required amount).
Whichever stake gets added to a block second, however, will only be
counted as a contribution of the available amount. So, for example, if
stake 1 gets added first and then stake 2 gets added you'll end up with
an active service node of:
- operator has 30% contributed and locked
- staker 1 has 40% contributed and locked
- staker 2 has 30% contributed but 60% locked.
This commit adds an upper bound for an acceptable stake that is 101% of
the available contribution room so that, in the above situation,
whichever stake gets added first will be a contribution and the second
one will fall through as an ordinary transaction back to the staker's
wallet so that the staker the re-contribute the proper amount.
2020-08-03 02:10:40 +02:00
// Maximum allowed stake contribution, as a fraction of the available contribution room. This
// should generally be slightly larger than 1. This is used to disallow large overcontributions
// which can happen when there are competing stakes submitted at the same time for the same
// service node.
using MAXIMUM_ACCEPTABLE_STAKE = std : : ratio < 101 , 100 > ;
2020-07-21 23:40:02 +02:00
// Used to estimate the blockchain height from a timestamp, with some grace time. This can drift
// slightly over time (because average block time is not typically *exactly*
// DIFFICULTY_TARGET_V2).
inline constexpr uint64_t HEIGHT_ESTIMATE_HEIGHT = 582088 ;
inline constexpr time_t HEIGHT_ESTIMATE_TIMESTAMP = 1595359932 ;
2020-07-21 22:40:17 +02:00
inline constexpr uint64_t CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX = 114 ;
inline constexpr uint64_t CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX = 115 ;
inline constexpr uint64_t CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX = 116 ;
inline constexpr uint16_t P2P_DEFAULT_PORT = 22022 ;
inline constexpr uint16_t RPC_DEFAULT_PORT = 22023 ;
inline constexpr uint16_t ZMQ_RPC_DEFAULT_PORT = 22024 ;
inline constexpr uint16_t QNET_DEFAULT_PORT = 22025 ;
inline constexpr boost : : uuids : : uuid const NETWORK_ID = { {
2018-05-03 04:49:06 +02:00
0x46 , 0x61 , 0x72 , 0x62 , 0x61 , 0x75 , 0x74 , 0x69 , 0x2a , 0x4c , 0x61 , 0x75 , 0x66 , 0x65 , 0x79
2014-09-05 04:14:36 +02:00
} } ; // Bender's nightmare
2020-07-21 22:40:17 +02:00
inline constexpr std : : string_view GENESIS_TX = " 021e01ff000380808d93f5d771027c4fd4553bc9886f1f49e3f76d945bf71e8632a94e6c177b19cbc780e7e6bdb48080b4ccd4dfc60302c8b9f6461f58ef3f2107e577c7425d06af584a1c7482bf19060e84059c98b4c3808088fccdbcc32302732b53b0b0db706fcc3087074fb4b786da5ab72b2065699f9453448b0db27f892101ed71f2ce3fc70d7b2036f8a4e4b3fb75c66c12184b55a908e7d1a1d6995566cf00 " sv ;
inline constexpr uint32_t GENESIS_NONCE = 1022201 ;
2014-09-05 04:14:36 +02:00
2020-08-07 01:44:23 +02:00
inline constexpr uint64_t GOVERNANCE_REWARD_INTERVAL_IN_BLOCKS = BLOCKS_EXPECTED_IN_DAYS ( 7 ) ;
2020-07-21 22:40:17 +02:00
inline constexpr std : : array GOVERNANCE_WALLET_ADDRESS =
2018-11-12 04:02:21 +01:00
{
2020-07-21 22:40:17 +02:00
" LCFxT37LAogDn1jLQKf4y7aAqfi21DjovX9qyijaLYQSdrxY1U5VGcnMJMjWrD9RhjeK5Lym67wZ73uh9AujXLQ1RKmXEyL " sv , // hardfork v7-10
" LDBEN6Ut4NkMwyaXWZ7kBEAx8X64o6YtDhLXUP26uLHyYT4nFmcaPU2Z2fauqrhTLh4Qfr61pUUZVLaTHqAdycETKM1STrz " sv , // hardfork v11
2018-11-12 04:02:21 +01:00
} ;
2021-03-24 23:20:16 +01:00
inline constexpr auto UPTIME_PROOF_TOLERANCE = 5 min ; // How much an uptime proof timestamp can deviate from our timestamp before we refuse it
inline constexpr auto UPTIME_PROOF_STARTUP_DELAY = 30 s ; // How long to wait after startup before broadcasting a proof
inline constexpr auto UPTIME_PROOF_CHECK_INTERVAL = 30 s ; // How frequently to check whether we need to broadcast a proof
inline constexpr auto UPTIME_PROOF_FREQUENCY = 1 h ; // How often to send proofs out to the network since the last proof we successfully sent. (Approximately; this can be up to CHECK_INTERFACE/2 off in either direction). The minimum accepted time between proofs is half of this.
inline constexpr auto UPTIME_PROOF_VALIDITY = 2 h + 5 min ; // The maximum time that we consider an uptime proof to be valid (i.e. after this time since the last proof we consider the SN to be down)
2021-06-04 21:17:31 +02:00
inline constexpr auto REACHABLE_MAX_FAILURE_VALIDITY = 5 min ; // If we don't hear any SS ping/lokinet session test failures for more than this long then we start considering the SN as passing for the purpose of obligation testing until we get another test result. This should be somewhat larger than SS/lokinet's max re-test backoff (2min).
2021-03-24 23:20:16 +01:00
2020-04-01 14:31:00 +02:00
// Hash domain separators
2020-07-21 22:40:17 +02:00
inline constexpr std : : string_view HASH_KEY_BULLETPROOF_EXPONENT = " bulletproof " sv ;
inline constexpr std : : string_view HASH_KEY_RINGDB = " ringdsb \0 " sv ;
inline constexpr std : : string_view HASH_KEY_SUBADDRESS = " SubAddr \0 " sv ;
inline constexpr unsigned char HASH_KEY_ENCRYPTED_PAYMENT_ID = 0x8d ;
inline constexpr unsigned char HASH_KEY_WALLET = 0x8c ;
inline constexpr unsigned char HASH_KEY_WALLET_CACHE = 0x8d ;
inline constexpr unsigned char HASH_KEY_RPC_PAYMENT_NONCE = 0x58 ;
inline constexpr unsigned char HASH_KEY_MEMORY = ' k ' ;
inline constexpr std : : string_view HASH_KEY_MULTISIG = " Multisig \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 " sv ;
2019-08-29 13:35:12 +02:00
inline constexpr std : : string_view HASH_KEY_CLSAG_ROUND = " CLSAG_round " sv ;
inline constexpr std : : string_view HASH_KEY_CLSAG_AGG_0 = " CLSAG_agg_0 " sv ;
inline constexpr std : : string_view HASH_KEY_CLSAG_AGG_1 = " CLSAG_agg_1 " sv ;
2020-04-01 14:31:00 +02:00
2022-04-29 01:51:14 +02:00
//Batching SN Rewards
inline constexpr uint64_t BATCHING_INTERVAL = 2520 ;
inline constexpr uint64_t MIN_BATCH_PAYMENT_AMOUNT = 1 ' 000 ' 000 ' 000 ; // 1 OXEN (in atomic units)
inline constexpr uint64_t LIMIT_BATCH_OUTPUTS = 15 ;
// If a node has been online for this amount of blocks they will receive SN rewards
inline constexpr uint64_t SERVICE_NODE_PAYABLE_AFTER_BLOCKS = 720 ;
2014-09-05 04:14:36 +02:00
namespace testnet
{
2020-07-21 23:40:02 +02:00
inline constexpr uint64_t HEIGHT_ESTIMATE_HEIGHT = 339767 ;
inline constexpr time_t HEIGHT_ESTIMATE_TIMESTAMP = 1595360006 ;
2020-07-21 22:40:17 +02:00
inline constexpr uint64_t CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX = 156 ;
inline constexpr uint64_t CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX = 157 ;
inline constexpr uint64_t CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX = 158 ;
inline constexpr uint16_t P2P_DEFAULT_PORT = 38156 ;
inline constexpr uint16_t RPC_DEFAULT_PORT = 38157 ;
inline constexpr uint16_t ZMQ_RPC_DEFAULT_PORT = 38158 ;
inline constexpr uint16_t QNET_DEFAULT_PORT = 38159 ;
inline constexpr boost : : uuids : : uuid const NETWORK_ID = { {
Version 0.4.0 Release Candidate (#216)
* core: submit uptime proof immediately after registering
* Increase visibility of autostaking prompts
* quorum_cop: changed uptime proof prune timeout to 2 hours 10 minutes
* cleanup: removed scope limiting block
* check_tx_inputs: fix deregister double spend test to include deregisters from other heights
* config: new testnet network id, genesis tx, and version bump
* wallet2: fix testnet wallet blockheight approximation
* Fix change in address format in RPC which broke parsing and pooling contributors (#184)
* Fix service node endpoints for RPC to also use stdout (#185)
* fixed some further rct core tests (#180)
* Fix service node state by calling detached hooks on failure to switch to alt chain (#188)
* fixed block verification core tests (#186)
* fixed block verification core tests
* core tests: removed gen_block_miner_tx_out_is_small which is only relevant to hardfork version 1
* Don't consider expired deregistrations when filling block template
* Add unit tests for getting staking requirement (#191)
* First service node test (#190)
* core_tests: added service node tests
* core_tests: check balance after registration tx
* Fix underflow for popping rollback events (#189)
* Move deregistration age check into check_tx_inputs
* Zero initialise rct_signatures member txnFee is a uint64_t and has uninit values
* Enforce that deregisters must be 0 fee since we skip checks
* Add unit tests for vote validation (#193)
* Add unit tests for deregistration validation (#194)
* Mainnet checkpoint 86535, testnet 3591, 4166
* Bump version number
* Add print_sr for getting staking requirement (#198)
* Misc bugfixes (#203)
* removed unnecessary cast to double during txfee+coinbase calculation
* simplewallet: increased autostaking interval from 2 minutes to 40
* Fix casting issues from uint to int (#204)
* core_tests: check service node registration and expiration (#195)
* core_tests: check service node registration and deregistration
* core_tests for service nodes:
- include service nodes rewards when calculating account's balance
- check that service nodes rewards have been received
* fixed namespace error; reduced the scope of staking requirement constants
* On blockchain inc/dec mark deregisters relayble based on age (#201)
* Service nodes restore only 1 rollback bug (#206)
* Fix restore 1 rollback event, ensure prevent rollback is always added
* Remove adding prevent_rollback event at init
It gets called in on block added generic anyway.
* Log db exception, fix relation operators for vote/deregister lifetime (#207)
* Filter relayable deregisters w/ check_tx_inputs instead of blockchain callbacks
* Bump version to 0.3.7-beta
* fix build with GCC 8.1.0 (#211)
* Add temp hardfork rule in testnet for deregister lifetimes (#210)
* Update testnet, remove testnet forks, remove checkpoints, update blockheight estimate (#212)
* Don't ban peers for a bad vote, just drop their connection (#213)
* Update to version 0.3.0 release candidate (#215)
2018-09-07 07:14:28 +02:00
0x5f , 0x3a , 0x78 , 0x65 , 0xe1 , 0x6f , 0xca , 0xb8 , 0x02 , 0xa1 , 0xdc , 0x17 , 0x61 , 0x64 , 0x15 , 0xbe ,
2014-09-05 04:14:36 +02:00
} } ; // Bender's daydream
2020-07-21 22:40:17 +02:00
inline constexpr std : : string_view GENESIS_TX = " 03011e001e01ff00018080c9db97f4fb270259b546996f69aa71abe4238995f41d780ab1abebcac9f00e808f147bdb9e3228420112573af8c309b69a1a646f41b5212ba7d9c4590bf86e04f36c486467cfef9d3d72000000000000000000000000000000000000000000000000000000000000000000 " sv ;
inline constexpr uint32_t GENESIS_NONCE = 10001 ;
2018-02-28 15:53:59 +01:00
2020-07-21 22:40:17 +02:00
inline constexpr uint64_t GOVERNANCE_REWARD_INTERVAL_IN_BLOCKS = 1000 ;
inline constexpr std : : array GOVERNANCE_WALLET_ADDRESS =
2018-11-12 04:02:21 +01:00
{
2020-07-21 22:40:17 +02:00
" T6SUprTYE5rQpep9iQFxyPcKVd91DFR1fQ1Qsyqp5eYLiFc8XuYd3reRE71qDL8c3DXioUbDEpDFdaUpetnL37NS1R3rzoKxi " sv , // hardfork v7-9
" T6TzkJb5EiASaCkcH7idBEi1HSrpSQJE1Zq3aL65ojBMPZvqHNYPTL56i3dncGVNEYCG5QG5zrBmRiVwcg6b1cRM1SRNqbp44 " sv , // hardfork v10
2018-11-12 04:02:21 +01:00
} ;
2021-03-24 23:20:16 +01:00
// Testnet uptime proofs are 6x faster than mainnet (devnet config also uses these)
inline constexpr auto UPTIME_PROOF_FREQUENCY = 10 min ;
inline constexpr auto UPTIME_PROOF_VALIDITY = 21 min ;
2022-04-29 01:51:14 +02:00
inline constexpr uint64_t BATCHING_INTERVAL = 20 ;
inline constexpr uint64_t SERVICE_NODE_PAYABLE_AFTER_BLOCKS = 4 ;
2014-09-05 04:14:36 +02:00
}
2018-02-16 12:04:04 +01:00
2020-08-11 23:41:54 +02:00
namespace devnet
2018-02-16 12:04:04 +01:00
{
2020-08-11 23:47:19 +02:00
inline constexpr uint64_t HEIGHT_ESTIMATE_HEIGHT = 0 ;
inline constexpr time_t HEIGHT_ESTIMATE_TIMESTAMP = 1597170000 ;
inline constexpr uint64_t CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX = 3930 ; // ~ dV1 .. dV3
inline constexpr uint64_t CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX = 4442 ; // ~ dVA .. dVC
inline constexpr uint64_t CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX = 5850 ; // ~dVa .. dVc
inline constexpr uint16_t P2P_DEFAULT_PORT = 38856 ;
inline constexpr uint16_t RPC_DEFAULT_PORT = 38857 ;
inline constexpr uint16_t ZMQ_RPC_DEFAULT_PORT = 38858 ;
inline constexpr uint16_t QNET_DEFAULT_PORT = 38859 ;
2020-07-21 22:40:17 +02:00
inline constexpr boost : : uuids : : uuid const NETWORK_ID = { {
2021-05-06 07:31:49 +02:00
0xa9 , 0xf7 , 0x5c , 0x7d , 0x55 , 0x17 , 0xcb , 0x6b , 0x5b , 0xf4 , 0x63 , 0x79 , 0x7a , 0x57 , 0xab , 0xd3
2020-08-11 23:47:19 +02:00
} } ;
inline constexpr std : : string_view GENESIS_TX = " 04011e1e01ff00018080c9db97f4fb2702fa27e905f604faa4eb084ee675faca77b0cfea9adec1526da33cae5e286f31624201dae05bf3fa1662b7fd373c92426763d921cf3745e10ee43edb510f690c656f247200000000000000000000000000000000000000000000000000000000000000000000 " sv ;
inline constexpr uint32_t GENESIS_NONCE = 12345 ;
2018-04-09 01:32:12 +02:00
2020-08-07 01:44:23 +02:00
inline constexpr uint64_t GOVERNANCE_REWARD_INTERVAL_IN_BLOCKS = BLOCKS_EXPECTED_IN_DAYS ( 7 ) ;
2020-07-21 22:40:17 +02:00
inline constexpr std : : array GOVERNANCE_WALLET_ADDRESS =
2018-11-12 04:02:21 +01:00
{
2020-08-11 23:47:19 +02:00
" dV3EhSE1xXgSzswBgVioqFNTfcqGopvTrcYjs4YDLHUfU64DuHxFoEmbwoyipTidGiTXx5EuYdgzZhDLMTo9uEv82M4A7Uimp " sv , // hardfork v7-9
" dV3EhSE1xXgSzswBgVioqFNTfcqGopvTrcYjs4YDLHUfU64DuHxFoEmbwoyipTidGiTXx5EuYdgzZhDLMTo9uEv82M4A7Uimp " sv , // hardfork v10
2018-11-12 04:02:21 +01:00
} ;
2021-05-06 07:31:49 +02:00
inline constexpr auto UPTIME_PROOF_STARTUP_DELAY = 5 s ;
2018-02-16 12:04:04 +01:00
}
2021-03-24 23:20:16 +01:00
namespace fakechain {
// Fakechain uptime proofs are 60x faster than mainnet, because this really only runs on a
// hand-crafted, typically local temporary network.
inline constexpr auto UPTIME_PROOF_STARTUP_DELAY = 5 s ;
inline constexpr auto UPTIME_PROOF_CHECK_INTERVAL = 5 s ;
inline constexpr auto UPTIME_PROOF_FREQUENCY = 1 min ;
inline constexpr auto UPTIME_PROOF_VALIDITY = 2 min + 5 s ;
}
2018-02-16 12:04:04 +01:00
}
namespace cryptonote
{
2018-11-12 04:02:21 +01:00
enum network_version
{
network_version_7 = 7 ,
network_version_8 ,
network_version_9_service_nodes , // Proof Of Stake w/ Service Nodes
network_version_10_bulletproofs , // Bulletproofs, Service Node Grace Registration Period, Batched Governance
2019-07-11 08:16:16 +02:00
network_version_11_infinite_staking , // Infinite Staking, CN-Turtle
2021-01-04 04:19:42 +01:00
network_version_12_checkpointing , // Checkpointing, Relaxed Deregistration, RandomXL, Oxen Storage Server
2019-09-10 02:04:44 +02:00
network_version_13_enforce_checkpoints ,
2020-01-21 07:16:08 +01:00
network_version_14_blink ,
2021-02-12 05:19:30 +01:00
network_version_15_ons ,
2020-09-18 21:39:50 +02:00
network_version_16_pulse ,
2021-06-10 17:19:28 +02:00
network_version_17 ,
network_version_18 ,
network_version_19 ,
2019-03-27 10:13:22 +01:00
network_version_count ,
2018-11-12 04:02:21 +01:00
} ;
2018-02-16 12:04:04 +01:00
enum network_type : uint8_t
{
MAINNET = 0 ,
TESTNET ,
2020-08-11 23:41:54 +02:00
DEVNET ,
2018-03-19 00:36:20 +01:00
FAKECHAIN ,
UNDEFINED = 255
2018-02-16 12:04:04 +01:00
} ;
2020-08-19 03:13:46 +02:00
inline constexpr std : : string_view network_type_str ( network_type nettype )
{
switch ( nettype )
{
case MAINNET : return " Mainnet " sv ;
case TESTNET : return " Testnet " sv ;
case DEVNET : return " Devnet " sv ;
case FAKECHAIN : return " Fakenet " sv ;
case UNDEFINED : return " Undefined Net " sv ;
}
return " Unhandled Net " sv ;
}
2020-07-21 22:40:17 +02:00
struct network_config
2018-06-11 05:16:29 +02:00
{
2020-07-21 22:40:17 +02:00
network_type NETWORK_TYPE ;
2020-07-21 23:40:02 +02:00
uint64_t HEIGHT_ESTIMATE_HEIGHT ;
time_t HEIGHT_ESTIMATE_TIMESTAMP ;
2018-11-12 04:02:21 +01:00
uint64_t CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX ;
uint64_t CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX ;
uint64_t CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX ;
uint16_t P2P_DEFAULT_PORT ;
uint16_t RPC_DEFAULT_PORT ;
uint16_t ZMQ_RPC_DEFAULT_PORT ;
2019-10-15 19:45:58 +02:00
uint16_t QNET_DEFAULT_PORT ;
2018-11-12 04:02:21 +01:00
boost : : uuids : : uuid NETWORK_ID ;
2020-07-21 22:40:17 +02:00
std : : string_view GENESIS_TX ;
2018-11-12 04:02:21 +01:00
uint32_t GENESIS_NONCE ;
uint64_t GOVERNANCE_REWARD_INTERVAL_IN_BLOCKS ;
2020-07-21 22:40:17 +02:00
std : : array < std : : string_view , 2 > GOVERNANCE_WALLET_ADDRESS ;
2021-03-24 23:20:16 +01:00
std : : chrono : : seconds UPTIME_PROOF_TOLERANCE ;
std : : chrono : : seconds UPTIME_PROOF_STARTUP_DELAY ;
std : : chrono : : seconds UPTIME_PROOF_CHECK_INTERVAL ;
std : : chrono : : seconds UPTIME_PROOF_FREQUENCY ;
std : : chrono : : seconds UPTIME_PROOF_VALIDITY ;
2022-04-29 01:51:14 +02:00
uint64_t BATCHING_INTERVAL ;
uint64_t MIN_BATCH_PAYMENT_AMOUNT ;
uint64_t LIMIT_BATCH_OUTPUTS ;
uint64_t SERVICE_NODE_PAYABLE_AFTER_BLOCKS ;
2020-07-21 22:40:17 +02:00
inline constexpr std : : string_view governance_wallet_address ( int hard_fork_version ) const {
const auto wallet_switch =
( NETWORK_TYPE = = MAINNET | | NETWORK_TYPE = = FAKECHAIN )
? network_version_11_infinite_staking
: network_version_10_bulletproofs ;
return GOVERNANCE_WALLET_ADDRESS [ hard_fork_version > = wallet_switch ? 1 : 0 ] ;
}
} ;
2021-03-24 23:20:16 +01:00
inline constexpr network_config mainnet_config {
2020-07-21 22:40:17 +02:00
MAINNET ,
2020-07-21 23:40:02 +02:00
: : config : : HEIGHT_ESTIMATE_HEIGHT ,
: : config : : HEIGHT_ESTIMATE_TIMESTAMP ,
2020-07-21 22:40:17 +02:00
: : config : : CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX ,
: : config : : CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX ,
: : config : : CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX ,
: : config : : P2P_DEFAULT_PORT ,
: : config : : RPC_DEFAULT_PORT ,
: : config : : ZMQ_RPC_DEFAULT_PORT ,
: : config : : QNET_DEFAULT_PORT ,
: : config : : NETWORK_ID ,
: : config : : GENESIS_TX ,
: : config : : GENESIS_NONCE ,
: : config : : GOVERNANCE_REWARD_INTERVAL_IN_BLOCKS ,
: : config : : GOVERNANCE_WALLET_ADDRESS ,
2021-03-24 23:20:16 +01:00
config : : UPTIME_PROOF_TOLERANCE ,
config : : UPTIME_PROOF_STARTUP_DELAY ,
config : : UPTIME_PROOF_CHECK_INTERVAL ,
config : : UPTIME_PROOF_FREQUENCY ,
config : : UPTIME_PROOF_VALIDITY ,
2022-04-29 01:51:14 +02:00
config : : BATCHING_INTERVAL ,
config : : MIN_BATCH_PAYMENT_AMOUNT ,
config : : LIMIT_BATCH_OUTPUTS ,
config : : SERVICE_NODE_PAYABLE_AFTER_BLOCKS ,
2020-07-21 22:40:17 +02:00
} ;
2021-03-24 23:20:16 +01:00
inline constexpr network_config testnet_config {
2020-07-21 22:40:17 +02:00
TESTNET ,
2020-07-21 23:40:02 +02:00
: : config : : testnet : : HEIGHT_ESTIMATE_HEIGHT ,
: : config : : testnet : : HEIGHT_ESTIMATE_TIMESTAMP ,
2020-07-21 22:40:17 +02:00
: : config : : testnet : : CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX ,
: : config : : testnet : : CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX ,
: : config : : testnet : : CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX ,
: : config : : testnet : : P2P_DEFAULT_PORT ,
: : config : : testnet : : RPC_DEFAULT_PORT ,
: : config : : testnet : : ZMQ_RPC_DEFAULT_PORT ,
: : config : : testnet : : QNET_DEFAULT_PORT ,
: : config : : testnet : : NETWORK_ID ,
: : config : : testnet : : GENESIS_TX ,
: : config : : testnet : : GENESIS_NONCE ,
: : config : : testnet : : GOVERNANCE_REWARD_INTERVAL_IN_BLOCKS ,
: : config : : testnet : : GOVERNANCE_WALLET_ADDRESS ,
2021-03-24 23:20:16 +01:00
config : : UPTIME_PROOF_TOLERANCE ,
config : : UPTIME_PROOF_STARTUP_DELAY ,
config : : UPTIME_PROOF_CHECK_INTERVAL ,
config : : testnet : : UPTIME_PROOF_FREQUENCY ,
config : : testnet : : UPTIME_PROOF_VALIDITY ,
2022-04-29 01:51:14 +02:00
: : config : : testnet : : BATCHING_INTERVAL ,
config : : MIN_BATCH_PAYMENT_AMOUNT ,
config : : LIMIT_BATCH_OUTPUTS ,
: : config : : testnet : : SERVICE_NODE_PAYABLE_AFTER_BLOCKS ,
2020-07-21 22:40:17 +02:00
} ;
2021-03-24 23:20:16 +01:00
inline constexpr network_config devnet_config {
2020-08-11 23:41:54 +02:00
DEVNET ,
: : config : : devnet : : HEIGHT_ESTIMATE_HEIGHT ,
: : config : : devnet : : HEIGHT_ESTIMATE_TIMESTAMP ,
: : config : : devnet : : CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX ,
: : config : : devnet : : CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX ,
: : config : : devnet : : CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX ,
: : config : : devnet : : P2P_DEFAULT_PORT ,
: : config : : devnet : : RPC_DEFAULT_PORT ,
: : config : : devnet : : ZMQ_RPC_DEFAULT_PORT ,
: : config : : devnet : : QNET_DEFAULT_PORT ,
: : config : : devnet : : NETWORK_ID ,
: : config : : devnet : : GENESIS_TX ,
: : config : : devnet : : GENESIS_NONCE ,
: : config : : devnet : : GOVERNANCE_REWARD_INTERVAL_IN_BLOCKS ,
: : config : : devnet : : GOVERNANCE_WALLET_ADDRESS ,
2021-03-24 23:20:16 +01:00
config : : UPTIME_PROOF_TOLERANCE ,
config : : UPTIME_PROOF_STARTUP_DELAY ,
config : : UPTIME_PROOF_CHECK_INTERVAL ,
config : : testnet : : UPTIME_PROOF_FREQUENCY ,
config : : testnet : : UPTIME_PROOF_VALIDITY ,
2022-04-29 01:51:14 +02:00
: : config : : testnet : : BATCHING_INTERVAL ,
config : : MIN_BATCH_PAYMENT_AMOUNT ,
config : : LIMIT_BATCH_OUTPUTS ,
: : config : : testnet : : SERVICE_NODE_PAYABLE_AFTER_BLOCKS ,
2020-07-21 22:40:17 +02:00
} ;
2021-03-24 23:20:16 +01:00
inline constexpr network_config fakenet_config {
2020-07-21 22:40:17 +02:00
FAKECHAIN ,
2020-07-21 23:40:02 +02:00
: : config : : HEIGHT_ESTIMATE_HEIGHT ,
: : config : : HEIGHT_ESTIMATE_TIMESTAMP ,
2020-07-21 22:40:17 +02:00
: : config : : CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX ,
: : config : : CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX ,
: : config : : CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX ,
: : config : : P2P_DEFAULT_PORT ,
: : config : : RPC_DEFAULT_PORT ,
: : config : : ZMQ_RPC_DEFAULT_PORT ,
: : config : : QNET_DEFAULT_PORT ,
: : config : : NETWORK_ID ,
: : config : : GENESIS_TX ,
: : config : : GENESIS_NONCE ,
100 , //::config::GOVERNANCE_REWARD_INTERVAL_IN_BLOCKS,
: : config : : GOVERNANCE_WALLET_ADDRESS ,
2021-03-24 23:20:16 +01:00
config : : UPTIME_PROOF_TOLERANCE ,
config : : fakechain : : UPTIME_PROOF_STARTUP_DELAY ,
config : : fakechain : : UPTIME_PROOF_CHECK_INTERVAL ,
config : : fakechain : : UPTIME_PROOF_FREQUENCY ,
config : : fakechain : : UPTIME_PROOF_VALIDITY ,
2022-04-29 01:51:14 +02:00
: : config : : testnet : : BATCHING_INTERVAL ,
config : : MIN_BATCH_PAYMENT_AMOUNT ,
config : : LIMIT_BATCH_OUTPUTS ,
: : config : : testnet : : SERVICE_NODE_PAYABLE_AFTER_BLOCKS ,
2018-06-11 05:16:29 +02:00
} ;
2018-11-12 04:02:21 +01:00
2020-07-21 22:40:17 +02:00
inline constexpr const network_config & get_config ( network_type nettype )
{
2018-06-11 05:16:29 +02:00
switch ( nettype )
{
2020-07-21 22:40:17 +02:00
case MAINNET : return mainnet_config ;
case TESTNET : return testnet_config ;
2020-08-11 23:41:54 +02:00
case DEVNET : return devnet_config ;
2020-07-21 22:40:17 +02:00
case FAKECHAIN : return fakenet_config ;
default : throw std : : runtime_error { " Invalid network type " } ;
2018-06-11 05:16:29 +02:00
}
2020-07-21 22:40:17 +02:00
}
2018-03-06 03:24:39 +01:00
}