From 1d5b2d8412fc0360e83ada11221ef979d1e482fc Mon Sep 17 00:00:00 2001 From: grapeLux2 Date: Wed, 15 Jan 2020 18:00:42 +0000 Subject: [PATCH 1/2] ability to stake and run MNs from the same wallet at the same time --- src/stake.cpp | 3 +++ src/stake.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/stake.cpp b/src/stake.cpp index 8538377b..a4aaf4a2 100755 --- a/src/stake.cpp +++ b/src/stake.cpp @@ -758,6 +758,7 @@ bool Stake::CheckProof(CBlockIndex* const pindexPrev, const CBlock &block, uint2 // Verify amount and split const CAmount& amount = txPrev.vout[txin.prevout.n].nValue; + if (nBlockHeight >= REJECT_INVALID_SPLIT_BLOCK_HEIGHT) { if (tx.vout.size() > (nBlockHeight > Params().StartDevfeeBlock() ? 4 : 3) && amount < (GetStakeCombineThreshold() * COIN * 2)) //Make space for an extra vout on splits, because of the devfee payment return error("%s: Invalid stake block format", __func__); @@ -765,6 +766,8 @@ bool Stake::CheckProof(CBlockIndex* const pindexPrev, const CBlock &block, uint2 return error("%s: Invalid stake block", __func__); if (isForbidden(txPrev.vout[txin.prevout.n].scriptPubKey)) return error("%s: Refused stake block", __func__); + if (amount == STAKE_INVALID_MN) // stop a MN's collateral from being staked + return error("%s: prevented masternode from staking", __func__); } // Verify signature and script diff --git a/src/stake.h b/src/stake.h index 64dd85ff..c7f25f83 100755 --- a/src/stake.h +++ b/src/stake.h @@ -35,6 +35,8 @@ namespace boost { class thread_group; } static const int REJECT_INVALID_SPLIT_BLOCK_HEIGHT = 465000; // Reject stake of small inputs static const CAmount STAKE_INVALID_SPLIT_MIN_COINS = 90 * COIN; +// Reject stake that is 16120 (a masternode) +static const CAmount STAKE_INVALID_MN = 16120 * COIN; // 1 LUX less then a MN struct StakeKernel { From 981e8b16dd65d2db8addf955fca6df934b32db1d Mon Sep 17 00:00:00 2001 From: grapeLux2 Date: Wed, 15 Jan 2020 18:04:07 +0000 Subject: [PATCH 2/2] removed comment --- src/stake.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stake.h b/src/stake.h index c7f25f83..9dc028eb 100755 --- a/src/stake.h +++ b/src/stake.h @@ -36,7 +36,7 @@ static const int REJECT_INVALID_SPLIT_BLOCK_HEIGHT = 465000; // Reject stake of small inputs static const CAmount STAKE_INVALID_SPLIT_MIN_COINS = 90 * COIN; // Reject stake that is 16120 (a masternode) -static const CAmount STAKE_INVALID_MN = 16120 * COIN; // 1 LUX less then a MN +static const CAmount STAKE_INVALID_MN = 16120 * COIN; struct StakeKernel {