Skip to content

Commit

Permalink
Remove IsProofOfStake
Browse files Browse the repository at this point in the history
  • Loading branch information
mban259 committed Apr 29, 2019
1 parent 89bb95c commit 2ac7991
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 22 deletions.
8 changes: 0 additions & 8 deletions src/chainparams.h
Expand Up @@ -25,12 +25,6 @@ struct CCheckpointData {
MapCheckpoints mapCheckpoints;
};

typedef std::map<uint256, uint32_t> MapPoSNonce;

struct CPoSNonceData {
MapPoSNonce mapPoSNonce;
};

/**
* Holds various statistics on transactions within a chain. Used to estimate
* verification progress during chain sync.
Expand Down Expand Up @@ -86,7 +80,6 @@ class CChainParams
const std::vector<SeedSpec6>& FixedSeeds() const { return vFixedSeeds; }
const CCheckpointData& Checkpoints() const { return checkpointData; }
const ChainTxData& TxData() const { return chainTxData; }
const CPoSNonceData& NonceData() const { return nonceData; }
void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout);
protected:
CChainParams() {}
Expand All @@ -106,7 +99,6 @@ class CChainParams
bool fMineBlocksOnDemand;
CCheckpointData checkpointData;
ChainTxData chainTxData;
CPoSNonceData nonceData;
bool m_fallback_fee_enabled;
};

Expand Down
11 changes: 0 additions & 11 deletions src/policy/stake.cpp
Expand Up @@ -13,7 +13,6 @@
#include <script/standard.h>
#include <stdio.h>
#include <key_io.h>
#include <chainparams.h>

bool AddressesEqual(const CScript& a, const CScript& b)
{
Expand Down Expand Up @@ -41,13 +40,3 @@ bool AddressesEqual(const CScript& a, const CScript& b)
//printf("a = %s b = %s\n", EncodeDestination(aAddress).c_str(), EncodeDestination(bAddress).c_str());
return aAddress == bAddress;
}

bool IsProofOfStake(const CBlockHeader& block)
{
if(block.nNonce == 0){
return true;
}
const MapPoSNonce& map = Params().NonceData().mapPoSNonce;
auto itr = map.find(block.GetHash());
return itr != map.end();
}
2 changes: 0 additions & 2 deletions src/policy/stake.h
Expand Up @@ -10,6 +10,4 @@

bool AddressesEqual(const CScript& a, const CScript& b);

bool IsProofOfStake(const CBlockHeader& block);

#endif //BITCOIN_POLICY_STAKE_H
2 changes: 1 addition & 1 deletion src/validation.cpp
Expand Up @@ -3231,7 +3231,7 @@ static bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos,
static bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, const Consensus::Params& consensusParams, bool fCheckPOW = true)
{
// Check proof of work matches claimed amount
if (fCheckPOW && !IsProofOfStake(block) && !CheckProofOfWork(block.GetHash(), block.nBits, consensusParams))
if (fCheckPOW && !CheckProofOfWork(block.GetHash(), block.nBits, consensusParams))
return state.DoS(50, false, REJECT_INVALID, "high-hash", false, "proof of work failed");

return true;
Expand Down

0 comments on commit 2ac7991

Please sign in to comment.