Make checkpoints.h little compact
authorsvost <ya.nowa@yandex.ru>
Wed, 20 Apr 2016 19:34:25 +0000 (22:34 +0300)
committersvost <ya.nowa@yandex.ru>
Wed, 20 Apr 2016 19:34:25 +0000 (22:34 +0300)
src/checkpoints.cpp
src/checkpoints.h

index 900c986..d93e559 100644 (file)
@@ -388,11 +388,62 @@ namespace Checkpoints
     }
 }
 
+void CUnsignedSyncCheckpoint::SetNull()
+{
+    nVersion = 1;
+    hashCheckpoint = 0;
+}
+
+std::string CUnsignedSyncCheckpoint::ToString() const
+{
+    return strprintf(
+        "CSyncCheckpoint(\n"
+        "    nVersion       = %" PRId32 "\n"
+        "    hashCheckpoint = %s\n"
+        ")\n",
+        nVersion,
+        hashCheckpoint.ToString().c_str());
+}
+
 // ppcoin: sync-checkpoint master key
 const string CSyncCheckpoint::strMasterPubKey = "04a51b735f816de4ec3f891d5b38bbc91e1f7245c7c08d17990760b86b4d8fc3910a850ffecf73bfa8886f01739a0c4c4322201282d07b6e48ce931cc92af94850";
 
 string CSyncCheckpoint::strMasterPrivKey = "";
 
+CSyncCheckpoint::CSyncCheckpoint()
+{
+    SetNull();
+}
+
+void CSyncCheckpoint::SetNull()
+{
+    CUnsignedSyncCheckpoint::SetNull();
+    vchMsg.clear();
+    vchSig.clear();
+}
+
+bool CSyncCheckpoint::IsNull() const
+{
+    return (hashCheckpoint == 0);
+}
+
+uint256 CSyncCheckpoint::GetHash() const
+{
+    return SerializeHash(*this);
+}
+
+bool CSyncCheckpoint::RelayTo(CNode* pnode) const
+{
+    // returns true if wasn't already sent
+    if (pnode->hashCheckpointKnown != hashCheckpoint)
+    {
+        pnode->hashCheckpointKnown = hashCheckpoint;
+        pnode->PushMessage("checkpoint", *this);
+        return true;
+    }
+    return false;
+}
+
 // ppcoin: verify signature of sync-checkpoint message
 bool CSyncCheckpoint::CheckSignature()
 {
index 79fd233..443be29 100644 (file)
@@ -77,22 +77,8 @@ public:
         READWRITE(hashCheckpoint);
     )
 
-    void SetNull()
-    {
-        nVersion = 1;
-        hashCheckpoint = 0;
-    }
-
-    std::string ToString() const
-    {
-        return strprintf(
-                "CSyncCheckpoint(\n"
-                "    nVersion       = %" PRId32 "\n"
-                "    hashCheckpoint = %s\n"
-                ")\n",
-            nVersion,
-            hashCheckpoint.ToString().c_str());
-    }
+    void SetNull();
+    std::string ToString() const;
 };
 
 class CSyncCheckpoint : public CUnsignedSyncCheckpoint
@@ -104,10 +90,7 @@ public:
     std::vector<unsigned char> vchMsg;
     std::vector<unsigned char> vchSig;
 
-    CSyncCheckpoint()
-    {
-        SetNull();
-    }
+    CSyncCheckpoint();
 
     IMPLEMENT_SERIALIZE
     (
@@ -115,35 +98,10 @@ public:
         READWRITE(vchSig);
     )
 
-    void SetNull()
-    {
-        CUnsignedSyncCheckpoint::SetNull();
-        vchMsg.clear();
-        vchSig.clear();
-    }
-
-    bool IsNull() const
-    {
-        return (hashCheckpoint == 0);
-    }
-
-    uint256 GetHash() const
-    {
-        return SerializeHash(*this);
-    }
-
-    bool RelayTo(CNode* pnode) const
-    {
-        // returns true if wasn't already sent
-        if (pnode->hashCheckpointKnown != hashCheckpoint)
-        {
-            pnode->hashCheckpointKnown = hashCheckpoint;
-            pnode->PushMessage("checkpoint", *this);
-            return true;
-        }
-        return false;
-    }
-
+    void SetNull();
+    bool IsNull() const;
+    uint256 GetHash() const;
+    bool RelayTo(CNode* pnode) const;
     bool CheckSignature();
     bool ProcessSyncCheckpoint(CNode* pfrom);
 };