Merge pull request #3592
authorWladimir J. van der Laan <laanwj@gmail.com>
Thu, 30 Jan 2014 15:45:11 +0000 (16:45 +0100)
committerWladimir J. van der Laan <laanwj@gmail.com>
Thu, 30 Jan 2014 15:45:26 +0000 (16:45 +0100)
c117d9e Support for error messages and a few more rejection reasons (Luke Dashjr)
14e7ffc Use standard BIP 22 rejection reasons where applicable (Luke Dashjr)

1  2 
src/main.cpp
src/main.h

diff --cc src/main.cpp
index 3c174a4650282b80eef0ba01df7e17a18e0b7e36,235d0a0e88814b825d93051fb774b028e93ca552..4532b776c69b0d165805e74d0dbb49efa441dd1e
@@@ -2337,16 -2269,13 +2337,16 @@@ bool ProcessBlock(CValidationState &sta
      // Check for duplicate
      uint256 hash = pblock->GetHash();
      if (mapBlockIndex.count(hash))
-         return state.Invalid(error("ProcessBlock() : already have block %d %s", mapBlockIndex[hash]->nHeight, hash.ToString()));
+         return state.Invalid(error("ProcessBlock() : already have block %d %s", mapBlockIndex[hash]->nHeight, hash.ToString()), 0, "duplicate");
      if (mapOrphanBlocks.count(hash))
-         return state.Invalid(error("ProcessBlock() : already have block (orphan) %s", hash.ToString()));
+         return state.Invalid(error("ProcessBlock() : already have block (orphan) %s", hash.ToString()), 0, "duplicate");
  
      // Preliminary checks
 -    if (!CheckBlock(*pblock, state))
 +    if (!CheckBlock(*pblock, state)) {
 +        if (state.CorruptionPossible())
 +            mapAlreadyAskedFor.erase(CInv(MSG_BLOCK, hash));
          return error("ProcessBlock() : CheckBlock FAILED");
 +    }
  
      CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(mapBlockIndex);
      if (pcheckpoint && pblock->hashPrevBlock != (chainActive.Tip() ? chainActive.Tip()->GetBlockHash() : uint256(0)))
diff --cc src/main.h
index ba353a885b32e95994c6cc706f68e7e2a5747423,6d431188328efc8796e115da5bfcd77c0608c596..bbf6fce48b68a226c454c81640a99656d7738120
@@@ -958,18 -958,18 +960,18 @@@ public
      }
      bool Abort(const std::string &msg) {
          AbortNode(msg);
-         return Error();
+         return Error(msg);
      }
 -    bool IsValid() {
 +    bool IsValid() const {
          return mode == MODE_VALID;
      }
 -    bool IsInvalid() {
 +    bool IsInvalid() const {
          return mode == MODE_INVALID;
      }
 -    bool IsError() {
 +    bool IsError() const {
          return mode == MODE_ERROR;
      }
 -    bool IsInvalid(int &nDoSOut) {
 +    bool IsInvalid(int &nDoSOut) const {
          if (IsInvalid()) {
              nDoSOut = nDoS;
              return true;
This page took 0.0449 seconds and 4 git commands to generate.