changeset 1601:57ebfef5b435 draft

Put OP_EVAL string in coinbase of generated blocks
author Gavin Andresen <gavinandresen@gmail.com>
date Thu, 13 Oct 2011 16:03:58 -0400
parents dc663e46a784
children e8605bf88eee
files src/base58.h src/main.cpp
diffstat 2 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/base58.h
+++ b/src/base58.h
@@ -270,7 +270,7 @@
 
     bool SetScriptHash160(const uint160& hash160)
     {
-        SetData(fTestNet ? 112 : 1, &hash160, 20);
+        SetData(fTestNet ? 111^2 : 2, &hash160, 20);
         return true;
     }
 
@@ -284,7 +284,7 @@
                 nExpectedSize = 20; // Hash of public key
                 fExpectTestNet = false;
                 break;
-            case 1:
+            case 2:
                 nExpectedSize = 20; // OP_EVAL, hash of CScript
                 fExpectTestNet = false;
                 break;
@@ -293,7 +293,7 @@
                 nExpectedSize = 20;
                 fExpectTestNet = true;
                 break;
-            case 112:
+            case 111^2:
                 nExpectedSize = 20;
                 fExpectTestNet = true;
                 break;
@@ -308,8 +308,8 @@
         if (!IsValid())
             return false;
         if (fTestNet)
-            return nVersion == 112;
-        return nVersion == 1;
+            return nVersion == 111^2;
+        return nVersion == 2;
     }
 
     CBitcoinAddress()
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2999,6 +2999,13 @@
     }
     ++nExtraNonce;
     pblock->vtx[0].vin[0].scriptSig = CScript() << pblock->nTime << CBigNum(nExtraNonce);
+
+    // Put "OP_EVAL" in the coinbase so everybody can tell when
+    // a majority of miners support it
+    const char* pOpEvalName = GetOpName(OP_EVAL);
+    pblock->vtx[0].vin[0].scriptSig += CScript() << std::vector<unsigned char>(pOpEvalName, pOpEvalName+strlen(pOpEvalName));
+    assert(pblock->vtx[0].vin[0].scriptSig.size() <= 100);
+
     pblock->hashMerkleRoot = pblock->BuildMerkleTree();
 }