Skip to content

Commit

Permalink
Merge pull request #199 from domob1812/strict-auxpow
Browse files Browse the repository at this point in the history
Disallow auxpow parent blocks that have auxpow themselves.
  • Loading branch information
phelixbtc committed Dec 4, 2014
2 parents 96624b9 + 1c0c73d commit d34714a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1633,6 +1633,14 @@ bool CBlock::CheckProofOfWork(int nHeight) const

if (auxpow.get() != NULL)
{
/* Disallow auxpow parent blocks that have an auxpow themselves. */
if (nHeight >= FORK_HEIGHT_STRICTCHECKS
&& (auxpow->parentBlock.nVersion & BLOCK_VERSION_AUXPOW))
return error("%s : auxpow parent block has auxpow version",
__func__);
assert(nHeight < FORK_HEIGHT_STRICTCHECKS
|| !auxpow->parentBlock.auxpow);

if (!auxpow->Check(GetHash(), GetChainID()))
return error("CheckProofOfWork() : AUX POW is not valid");
// Check proof of work matches claimed amount
Expand Down Expand Up @@ -3539,6 +3547,11 @@ bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey)

if (auxpow != NULL)
{
/* Disallow auxpow parent blocks that have an auxpow themselves. */
if (auxpow->parentBlock.nVersion & BLOCK_VERSION_AUXPOW)
return error("%s : auxpow parent block has auxpow version",
__func__);

if (!auxpow->Check(hash, pblock->GetChainID()))
return error("AUX POW is not valid");

Expand Down
5 changes: 5 additions & 0 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ static const int COINBASE_MATURITY = 100;
// -paytxfee default
static const int64 DEFAULT_TRANSACTION_FEE = MIN_TX_FEE;

/* Height of the softfork disallowing certain "buggy" constructions. This is
in preparation of the switch to the rebased client at some point later
in the future. */
static const int FORK_HEIGHT_STRICTCHECKS = 300000;

#ifdef USE_UPNP
static const int fHaveUPnP = true;
#else
Expand Down

0 comments on commit d34714a

Please sign in to comment.