From: Gavin Andresen Date: Thu, 13 Oct 2011 20:03:58 +0000 (-0400) Subject: Put OP_EVAL string in coinbase of generated blocks X-Git-Tag: v0.4.0-unstable~129^2~306^2~6 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=d7062ef1bd3319689d402027131f2c46efeddcb6 Put OP_EVAL string in coinbase of generated blocks --- diff --git a/src/base58.h b/src/base58.h index 8fc546c..4be1198 100644 --- a/src/base58.h +++ b/src/base58.h @@ -270,7 +270,7 @@ public: bool SetScriptHash160(const uint160& hash160) { - SetData(fTestNet ? 112 : 1, &hash160, 20); + SetData(fTestNet ? 111^2 : 2, &hash160, 20); return true; } @@ -284,7 +284,7 @@ public: 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 @@ public: nExpectedSize = 20; fExpectTestNet = true; break; - case 112: + case 111^2: nExpectedSize = 20; fExpectTestNet = true; break; @@ -308,8 +308,8 @@ public: if (!IsValid()) return false; if (fTestNet) - return nVersion == 112; - return nVersion == 1; + return nVersion == 111^2; + return nVersion == 2; } CBitcoinAddress() diff --git a/src/main.cpp b/src/main.cpp index 0fb383f..1b5bf52 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2999,6 +2999,13 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& } ++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(pOpEvalName, pOpEvalName+strlen(pOpEvalName)); + assert(pblock->vtx[0].vin[0].scriptSig.size() <= 100); + pblock->hashMerkleRoot = pblock->BuildMerkleTree(); }