diff --git a/README.md b/README.md index 255c3e011..8354a12fb 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,8 @@ Dates are provided in the format YYYY-MM-DD. | 2019-03-20 | v13 | 1.7.7 | 1.7.7 | RTA Mining | | 2019-06-06 | v14 | 1.8.1 | 1.8.1 | Merge with monero 13: bulletproofs enabled, fixed ring size 11 | | 2019-06-07 | v15 | 1.8.1 | 1.8.4 | bulletproofs required +| 2019-08-08 | v16 | 1.9.0 | 1.9.0 | maximum stake period is 32 days | + ## Installing Graft Network from a package diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index ec2ef57f8..bce4f4936 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -127,6 +127,8 @@ static const struct { { 14, 364590, 0, 1559833200 }, // hf 15 disable non-bulletproof, ~2019-06-07T15:00:00+00 { 15, 365310, 0, 1559919600 }, + // hf 15 increase stake period to 32 days, 2019-08-12@15:00:00+00 + { 16, 412780, 0, 1565622000 }, }; // static const uint64_t mainnet_hard_fork_version_1_till = 1009826; static const uint64_t mainnet_hard_fork_version_1_till = 1; @@ -169,6 +171,8 @@ static const struct { { 14, 336400, 0, 1558504800 }, // hf 15 disable non-bulletproof { 15, 343750, 0, 1559401200 }, + // hf 16 increase stake period to 32 days, 2019-08-05T@09:00:00+00 + { 16, 381520, 0, 1564995600 } }; // static const uint64_t testnet_hard_fork_version_1_till = 624633; diff --git a/src/cryptonote_core/stake_transaction_processor.cpp b/src/cryptonote_core/stake_transaction_processor.cpp index b774ca5f4..faf6d719f 100644 --- a/src/cryptonote_core/stake_transaction_processor.cpp +++ b/src/cryptonote_core/stake_transaction_processor.cpp @@ -214,11 +214,12 @@ void StakeTransactionProcessor::process_block_stake_transaction(uint64_t block_i << " because unlock time " << unlock_time << " is less than minimum allowed " << config::graft::STAKE_MIN_UNLOCK_TIME); continue; } - - if (unlock_time > config::graft::STAKE_MAX_UNLOCK_TIME) + const auto CURRENT_STAKE_MAX_UNLOCK_TIME = m_blockchain.get_current_hard_fork_version() < 16 ? config::graft::STAKE_MAX_UNLOCK_TIME_V15 + : config::graft::STAKE_MAX_UNLOCK_TIME; + if (unlock_time > CURRENT_STAKE_MAX_UNLOCK_TIME) { MWARNING("Ignore stake transaction at block #" << block_index << ", tx_hash=" << tx_hash << ", supernode_public_id '" << stake_tx.supernode_public_id << "'" - << " because unlock time " << unlock_time << " is greater than maximum allowed " << config::graft::STAKE_MAX_UNLOCK_TIME); + << " because unlock time " << unlock_time << " is greater than maximum allowed " << CURRENT_STAKE_MAX_UNLOCK_TIME); continue; } diff --git a/src/graft_rta_config.h b/src/graft_rta_config.h index 850a0bf77..5b9398a58 100644 --- a/src/graft_rta_config.h +++ b/src/graft_rta_config.h @@ -13,7 +13,8 @@ namespace graft constexpr uint8_t STAKE_TRANSACTION_PROCESSING_DB_VERSION = 13; constexpr uint64_t STAKE_MIN_UNLOCK_TIME = 10; -constexpr uint64_t STAKE_MAX_UNLOCK_TIME = 5000; +constexpr uint64_t STAKE_MAX_UNLOCK_TIME_V15 = 5000; +constexpr uint64_t STAKE_MAX_UNLOCK_TIME = 23040; constexpr uint64_t STAKE_MIN_UNLOCK_TIME_FOR_WALLET = 60; constexpr uint64_t STAKE_VALIDATION_PERIOD = 6; constexpr uint64_t TRUSTED_RESTAKING_PERIOD = 6; diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index a7f6f4408..a8caa3226 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -5017,9 +5017,16 @@ bool simple_wallet::transfer_main(int transfer_type, const std::vector config::graft::STAKE_MAX_UNLOCK_TIME) + // allow 32 days stake period from HF16 + uint64_t hf16_height = 0; + m_wallet->get_hard_fork_info(16, hf16_height); + + const auto CURRENT_STAKE_MAX_UNLOCK_TIME = m_wallet->get_blockchain_current_height() < hf16_height ? config::graft::STAKE_MAX_UNLOCK_TIME_V15 + : config::graft::STAKE_MAX_UNLOCK_TIME; + + if (locked_blocks > CURRENT_STAKE_MAX_UNLOCK_TIME) { - fail_msg_writer() << tr("locked blocks number ") << locked_blocks << tr(" is greater than maximum allowed ") << config::graft::STAKE_MAX_UNLOCK_TIME; + fail_msg_writer() << tr("locked blocks number ") << locked_blocks << tr(" is greater than maximum allowed ") << CURRENT_STAKE_MAX_UNLOCK_TIME; return true; } diff --git a/src/version.cpp.in b/src/version.cpp.in index 97cf5e10d..8ff45928a 100644 --- a/src/version.cpp.in +++ b/src/version.cpp.in @@ -1,5 +1,5 @@ #define DEF_GRAFT_VERSION_TAG "@VERSIONTAG@" -#define DEF_GRAFT_VERSION "1.8.4" +#define DEF_GRAFT_VERSION "1.9.0" #define DEF_GRAFT_RELEASE_NAME "Vela Pulsar" #define DEF_GRAFT_VERSION_FULL DEF_GRAFT_VERSION "-" DEF_GRAFT_VERSION_TAG diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index 3566c4f7b..4c35c8450 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -135,8 +135,14 @@ namespace er.message = "unlock_time is too low"; return false; } + // allow 32 days stake period from HF16 + uint64_t hf16_height = 0; + wallet->get_hard_fork_info(16, hf16_height); - if (req.unlock_time > current_height + config::graft::STAKE_MAX_UNLOCK_TIME) + const auto CURRENT_STAKE_MAX_UNLOCK_TIME = wallet->get_blockchain_current_height() < hf16_height ? config::graft::STAKE_MAX_UNLOCK_TIME_V15 + : config::graft::STAKE_MAX_UNLOCK_TIME; + + if (req.unlock_time > current_height + CURRENT_STAKE_MAX_UNLOCK_TIME) { er.code = WALLET_RPC_ERROR_CODE_GENERIC_TRANSFER_ERROR; er.message = "unlock_time is too high";