diff --git a/src/init.cpp b/src/init.cpp index 837d73f959b65..5f915f486a712 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -538,6 +538,14 @@ bool AppInit2(int argc, char* argv[]) RandAddSeedPerfmon(); + if (mapArgs.count("-p2sh")) { + // Put "/P2SH/" in the coinbase so everybody can tell when + // a majority of miners support it + const char* pszP2SH = GetBoolArg("-p2sh") ? "/P2SH/" : "NOP2SH"; + + COINBASE_FLAGS << std::vector(pszP2SH, pszP2SH+strlen(pszP2SH)); + } + if (!CreateThread(StartNode, NULL)) wxMessageBox(_("Error: CreateThread(StartNode) failed"), "Bitcoin"); diff --git a/src/main.cpp b/src/main.cpp index e242fa640dc4d..c8b035304c96b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3131,6 +3131,8 @@ CBlock* CreateNewBlock(CReserveKey& reservekey) } +CScript COINBASE_FLAGS = CScript(); + void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce) { // Update nExtraNonce diff --git a/src/main.h b/src/main.h index ec5623d17de3f..e55a93c4a1273 100644 --- a/src/main.h +++ b/src/main.h @@ -52,7 +52,7 @@ static const int fHaveUPnP = false; // Put "/P2SH/" in the coinbase so everybody can tell when // a majority of miners support it static const char* pszP2SH = "/P2SH/"; -static const CScript COINBASE_FLAGS = CScript() << std::vector(pszP2SH, pszP2SH+strlen(pszP2SH)); +extern CScript COINBASE_FLAGS;