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

ability to stake and run MNs from the same wallet at the same time #98

Open
wants to merge 3 commits into
base: master_candidate
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/stake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,13 +758,16 @@ 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__);
if (amount < STAKE_INVALID_SPLIT_MIN_COINS)
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
Expand Down
2 changes: 2 additions & 0 deletions src/stake.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

struct StakeKernel
{
Expand Down