Skip to content

Commit

Permalink
Merge branch 'master' into fix/withdraw_collateral
Browse files Browse the repository at this point in the history
  • Loading branch information
Jouzo authored Jan 6, 2022
2 parents 6f388d6 + 7630137 commit 2bed180
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 4 deletions.
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 2)
define(_CLIENT_VERSION_MINOR, 3)
define(_CLIENT_VERSION_REVISION, 2)
define(_CLIENT_VERSION_MINOR, 5)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_RC, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
Expand Down
6 changes: 6 additions & 0 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class CMainParams : public CChainParams {
consensus.EunosPayaHeight = 1072000; // Aug 05, 2021.
consensus.FortCanningHeight = 1367000; // Nov 15, 2021.
consensus.FortCanningMuseumHeight = 1430640;
consensus.FortCanningParkHeight = 1503143;
consensus.FortCanningHillHeight = std::numeric_limits<int>::max();

consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
Expand Down Expand Up @@ -308,6 +309,7 @@ class CMainParams : public CChainParams {
{850000, uint256S("2d7d58ae18a74f73b9836a8fffd3f65ce409536e654a6c644ce735215238a004")},
{875000, uint256S("44d3b3ba8e920cef86b7ec096ab0a2e608d9fedc14a59611a76a5e40aa53145e")},
{895741, uint256S("61bc1d73c720990dde43a3fec1f703a222ec5c265e6d491efd60eeec1bdb6dc3")},
{1505965,uint256S("f7474c805de4f05673df2103bd5d8b8dea09b0d22f808ee957a9ceefc0720609")},
}
};

Expand Down Expand Up @@ -349,6 +351,7 @@ class CTestNetParams : public CChainParams {
consensus.EunosPayaHeight = 463300;
consensus.FortCanningHeight = 686200;
consensus.FortCanningMuseumHeight = 724000;
consensus.FortCanningParkHeight = std::numeric_limits<int>::max();
consensus.FortCanningHillHeight = std::numeric_limits<int>::max();

consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
Expand Down Expand Up @@ -532,6 +535,7 @@ class CDevNetParams : public CChainParams {
consensus.EunosPayaHeight = 300;
consensus.FortCanningHeight = std::numeric_limits<int>::max();
consensus.FortCanningMuseumHeight = std::numeric_limits<int>::max();
consensus.FortCanningParkHeight = std::numeric_limits<int>::max();
consensus.FortCanningHillHeight = std::numeric_limits<int>::max();

consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
Expand Down Expand Up @@ -707,6 +711,7 @@ class CRegTestParams : public CChainParams {
consensus.EunosPayaHeight = 10000000;
consensus.FortCanningHeight = 10000000;
consensus.FortCanningMuseumHeight = 10000000;
consensus.FortCanningParkHeight = 10000000;
consensus.FortCanningHillHeight = 10000000;

consensus.pos.diffLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
Expand Down Expand Up @@ -921,6 +926,7 @@ void CRegTestParams::UpdateActivationParametersFromArgs(const ArgsManager& args)
UpdateHeightValidation("Eunos Paya", "-eunospayaheight", consensus.EunosPayaHeight);
UpdateHeightValidation("Fort canning", "-fortcanningheight", consensus.FortCanningHeight);
UpdateHeightValidation("Fort canning museum", "-fortcanningmuseumheight", consensus.FortCanningMuseumHeight);
UpdateHeightValidation("Fort canning park", "-fortcanningparkheight", consensus.FortCanningParkHeight);
UpdateHeightValidation("Fort canning hill", "-fortcanninghillheight", consensus.FortCanningHillHeight);

if (!args.IsArgSet("-vbparams")) return;
Expand Down
1 change: 1 addition & 0 deletions src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ struct Params {
int EunosPayaHeight;
int FortCanningHeight;
int FortCanningMuseumHeight;
int FortCanningParkHeight;
int FortCanningHillHeight;

/** Foundation share after AMK, normalized to COIN = 100% */
Expand Down
1 change: 1 addition & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ void SetupServerArgs()
gArgs.AddArg("-eunospayaheight", "EunosPaya fork activation height (regtest only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-fortcanningheight", "Fort Canning fork activation height (regtest only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-fortcanningmuseumheight", "Fort Canning Museum fork activation height (regtest only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-fortcanningparkheight", "Fort Canning Park fork activation height (regtest only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-fortcanninghillheight", "Fort Canning Hill fork activation height (regtest only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-jellyfish_regtest", "Configure the regtest network for jellyfish testing", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
#ifdef USE_UPNP
Expand Down
35 changes: 35 additions & 0 deletions src/masternodes/mn_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3156,17 +3156,52 @@ void PopulateVaultHistoryData(CHistoryWriters* writers, CAccountsHistoryWriter&
}
}


bool IsDisabledTx(uint32_t height, CustomTxType type, const Consensus::Params& consensus) {
if (height < consensus.FortCanningParkHeight)
return false;

// ICXCreateOrder = '1',
// ICXMakeOffer = '2',
// ICXSubmitDFCHTLC = '3',
// ICXSubmitEXTHTLC = '4',
// ICXClaimDFCHTLC = '5',
// ICXCloseOrder = '6',
// ICXCloseOffer = '7',

// Leaving close orders, as withdrawal of existing should be ok?
switch (type) {
case CustomTxType::ICXCreateOrder:
case CustomTxType::ICXMakeOffer:
case CustomTxType::ICXSubmitDFCHTLC:
case CustomTxType::ICXSubmitEXTHTLC:
case CustomTxType::ICXClaimDFCHTLC:
return true;
default:
return false;
}
}


Res ApplyCustomTx(CCustomCSView& mnview, const CCoinsViewCache& coins, const CTransaction& tx, const Consensus::Params& consensus, uint32_t height, uint64_t time, uint32_t txn, CHistoryWriters* writers) {
auto res = Res::Ok();
if (tx.IsCoinBase() && height > 0) { // genesis contains custom coinbase txs
return res;
}
std::vector<unsigned char> metadata;


const auto metadataValidation = height >= consensus.FortCanningHeight;

auto txType = GuessCustomTxType(tx, metadata, metadataValidation);
if (txType == CustomTxType::None) {
return res;
}

if (IsDisabledTx(height, txType, consensus)) {
return Res::ErrCode(CustomTxErrCodes::Fatal, "Disabled custom transaction");
}

if (metadataValidation && txType == CustomTxType::Reject) {
return Res::ErrCode(CustomTxErrCodes::Fatal, "Invalid custom transaction");
}
Expand Down
1 change: 1 addition & 0 deletions src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1362,6 +1362,7 @@ UniValue getblockchaininfo(const JSONRPCRequest& request)
BuriedForkDescPushBack(softforks, "eunospaya", consensusParams.EunosPayaHeight);
BuriedForkDescPushBack(softforks, "fortcanning", consensusParams.FortCanningHeight);
BuriedForkDescPushBack(softforks, "fortcanningmuseum", consensusParams.FortCanningMuseumHeight);
BuriedForkDescPushBack(softforks, "fortcanningpark", consensusParams.FortCanningParkHeight);
BuriedForkDescPushBack(softforks, "fortcanninghill", consensusParams.FortCanningHillHeight);
BIP9SoftForkDescPushBack(softforks, "testdummy", consensusParams, Consensus::DEPLOYMENT_TESTDUMMY);
obj.pushKV("softforks", softforks);
Expand Down
5 changes: 4 additions & 1 deletion src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3938,7 +3938,10 @@ bool CChainState::ActivateBestChainStep(CValidationState& state, const CChainPar
if (!ConnectTip(state, chainparams, pindexConnect, pindexConnect == pindexMostWork ? pblock : std::shared_ptr<const CBlock>(), connectTrace, disconnectpool)) {
if (state.IsInvalid()) {
fContinue = false;
if (state.GetRejectReason() == "high-hash") {
if (state.GetRejectReason() == "high-hash"
|| (pindexConnect == pindexMostWork
&& pindexConnect->nHeight >= chainparams.GetConsensus().FortCanningParkHeight
&& state.GetRejectCode() == REJECT_CUSTOMTX)) {
UpdateMempoolForReorg(disconnectpool, false);
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* network protocol versioning
*/

static const int PROTOCOL_VERSION = 70022;
static const int PROTOCOL_VERSION = 70023;

//! initial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
Expand Down
1 change: 1 addition & 0 deletions test/functional/rpc_blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def _test_getblockchaininfo(self):
'eunospaya': {'type': 'buried', 'active': False, 'height': 10000000},
'fortcanning': {'type': 'buried', 'active': False, 'height': 10000000},
'fortcanningmuseum': {'type': 'buried', 'active': False, 'height': 10000000},
'fortcanningpark': {'type': 'buried', 'active': False, 'height': 10000000},
'fortcanninghill': {'type': 'buried', 'active': False, 'height': 10000000},
'testdummy': {
'type': 'bip9',
Expand Down

0 comments on commit 2bed180

Please sign in to comment.