Skip to content

Commit

Permalink
Raise build version.
Browse files Browse the repository at this point in the history
Remove duplicated code.
  • Loading branch information
tecnovert committed Jun 29, 2019
1 parent 9c7ee2f commit bbba621
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 46 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ define(_CLIENT_VERSION_MAJOR, 0)
define(_CLIENT_VERSION_MINOR, 18)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_PARTICL, 11)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_BUILD, 1)
define(_CLIENT_VERSION_RC, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2019)
Expand Down
1 change: 1 addition & 0 deletions doc/release-notes-particl.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Added smsggetinfo RPC command to display SMSG related information.
- Added smsgsetwallet RPC command to switch the active SMSG wallet without disabling SMSG.
- Unloading the active SMSG wallet will leave SMSG enabled.
- Fixed DOS vulnerability.


0.18.0.10
Expand Down
34 changes: 0 additions & 34 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1255,40 +1255,6 @@ void PeerLogicValidation::BlockChecked(const CBlock& block, const CValidationSta
mapBlockSource.erase(it);
}

bool IncomingBlockChecked(const CBlock &block, CValidationState &state)
{
LOCK(cs_main);

const uint256 hash(block.GetHash());
std::map<uint256, std::pair<NodeId, bool>>::iterator it = mapBlockSource.find(hash);

bool rv = true;
int nDoS = 0;
if (state.IsInvalid(nDoS)) {
if (it != mapBlockSource.end() && State(it->second.first)) {
assert (state.GetRejectCode() < REJECT_INTERNAL); // Blocks are never rejected with internal reject codes
CBlockReject reject = {(unsigned char)state.GetRejectCode(), state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), hash};
State(it->second.first)->rejects.push_back(reject);
state.nodeId = it->second.first;
if (nDoS > 0 && it->second.second)
Misbehaving(it->second.first, nDoS);
}
rv = false;
} else
if (state.nFlags & BLOCK_FAILED_DUPLICATE_STAKE)
{
if (it != mapBlockSource.end() && State(it->second.first))
Misbehaving(it->second.first, 10);
rv = false;
};

if (!rv)
if (it != mapBlockSource.end())
mapBlockSource.erase(it);

return rv;
}

//////////////////////////////////////////////////////////////////////////////
//
// Messages
Expand Down
2 changes: 0 additions & 2 deletions src/net_processing.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ struct CNodeStateStats {
int nLooseHeadersCount = 0;
};

bool IncomingBlockChecked(const CBlock &block, CValidationState &state);

/** Get statistics from node state */
bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats);
/** Increase a node's misbehavior score. */
Expand Down
4 changes: 2 additions & 2 deletions src/pos/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ int MAX_REORG_DEPTH = 1024;
static bool SpendTooDeep(const COutPoint &prevout) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
{
LogPrint(BCLog::POS, "%s: SpendTooDeep %s.\n", __func__, prevout.ToString());
CBlockIndex *pindexTip = ::ChainActive().Tip();
CBlockIndex *pindexTip = chainActive.Tip();

if (fSpentIndex) {
CSpentIndexKey key(prevout.hash, prevout.n);
Expand Down Expand Up @@ -251,7 +251,7 @@ bool CheckProofOfStake(CValidationState &state, const CBlockIndex *pindexPrev, c
}

if (SpendTooDeep(txin.prevout)) {
return state.Invalid(ValidationInvalidReason::CONSENSUS, error("%s: Tried to stake spent kernel", __func__), REJECT_INVALID, "invalid-prevout");
return state.DoS(100, error("%s: Tried to stake spent kernel", __func__), REJECT_INVALID, "invalid-prevout");
}

kernelPubKey = *outPrev->GetPScriptPubKey();
Expand Down
9 changes: 2 additions & 7 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,6 @@ CScript COINBASE_FLAGS;

const std::string strMessageMagic = "Bitcoin Signed Message:\n";

extern bool IncomingBlockChecked(const CBlock &block, CValidationState &state);

// Internal stuff
namespace {
CBlockIndex *&pindexBestInvalid = g_chainstate.pindexBestInvalid;
Expand Down Expand Up @@ -5070,7 +5068,7 @@ bool CChainState::AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CVali
// Header is valid/has work, merkle tree and segwit merkle tree are good...RELAY NOW
// (but if it does not build on our best tip, let the SendMessages loop relay it)
if (!(state.nFlags & (BLOCK_STAKE_KERNEL_SPENT | BLOCK_FAILED_DUPLICATE_STAKE))
&& !IsInitialBlockDownload() && m_chain.Tip() == pindex->pprev) {
&& !IsInitialBlockDownload() && chainActive.Tip() == pindex->pprev) {
GetMainSignals().NewPoWValidBlock(pindex, pblock);
}

Expand Down Expand Up @@ -5134,8 +5132,6 @@ bool ProcessNewBlock(const CChainParams& chainparams, const std::shared_ptr<cons
// Block will have been added to the block index in AcceptBlockHeader
CBlockIndex *pindex = g_chainstate.AddToBlockIndex(*pblock);
g_chainstate.InvalidBlockFound(pindex, *pblock, state);

IncomingBlockChecked(*pblock, state);
}
GetMainSignals().BlockChecked(*pblock, state);
return error("%s: AcceptBlock FAILED (%s)", __func__, FormatStateMessage(state));
Expand All @@ -5145,8 +5141,7 @@ bool ProcessNewBlock(const CChainParams& chainparams, const std::shared_ptr<cons
pindex->nFlags |= BLOCK_FAILED_DUPLICATE_STAKE;
setDirtyBlockIndex.insert(pindex);
LogPrint(BCLog::POS, "%s Marking duplicate stake: %s.\n", __func__, pindex->GetBlockHash().ToString());
//GetMainSignals().BlockChecked(*pblock, state);
IncomingBlockChecked(*pblock, state);
GetMainSignals().BlockChecked(*pblock, state);
}
}

Expand Down

0 comments on commit bbba621

Please sign in to comment.