diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2012-02-06 15:48:00 -0500 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2012-02-06 16:27:05 -0500 |
commit | 7bf8b7c25c944110dbe85ef9e4eebd858da34158 (patch) | |
tree | 943799640b2ceab894852cb1cd54158c582ec577 /src | |
parent | 0b9a05a2bc1c1c6a86cdd9f25d43ab7224fd8731 (diff) |
-bip16 option (default: 1) to support / not support BIP 16. And bumped default BIP16 switchover date from Feb 15 to Mar 1
Diffstat (limited to 'src')
-rw-r--r-- | src/init.cpp | 33 | ||||
-rw-r--r-- | src/main.cpp | 7 | ||||
-rw-r--r-- | src/main.h | 5 | ||||
-rw-r--r-- | src/util.cpp | 2 | ||||
-rw-r--r-- | src/util.h | 2 |
5 files changed, 34 insertions, 15 deletions
diff --git a/src/init.cpp b/src/init.cpp index 4bb3312902..97f5ce7ec0 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -474,19 +474,38 @@ bool AppInit2(int argc, char* argv[]) bool fTor = (fUseProxy && addrProxy.GetPort() == 9050); if (fTor) { - // Use SoftSetArg here so user can override any of these if they wish. + // Use SoftSetBoolArg here so user can override any of these if they wish. // Note: the GetBoolArg() calls for all of these must happen later. - SoftSetArg("-nolisten", true); - SoftSetArg("-noirc", true); - SoftSetArg("-nodnsseed", true); - SoftSetArg("-noupnp", true); - SoftSetArg("-upnp", false); - SoftSetArg("-dns", false); + SoftSetBoolArg("-nolisten", true); + SoftSetBoolArg("-noirc", true); + SoftSetBoolArg("-nodnsseed", true); + SoftSetBoolArg("-noupnp", true); + SoftSetBoolArg("-upnp", false); + SoftSetBoolArg("-dns", false); } fAllowDNS = GetBoolArg("-dns"); fNoListen = GetBoolArg("-nolisten"); + // This code can be removed once a super-majority of the network has upgraded. + if (GetBoolArg("-bip16", true)) + { + if (fTestNet) + SoftSetArg("-paytoscripthashtime", "1329264000"); // Feb 15 + else + SoftSetArg("-paytoscripthashtime", "1330578000"); // Mar 1 + + // Put "/P2SH/" in the coinbase so everybody can tell when + // a majority of miners support it + const char* pszP2SH = "/P2SH/"; + COINBASE_FLAGS << std::vector<unsigned char>(pszP2SH, pszP2SH+strlen(pszP2SH)); + } + else + { + const char* pszP2SH = "NOP2SH"; + COINBASE_FLAGS << std::vector<unsigned char>(pszP2SH, pszP2SH+strlen(pszP2SH)); + } + // Command-line args override in-wallet settings: if (mapArgs.count("-upnp")) fUseUPnP = GetBoolArg("-upnp"); diff --git a/src/main.cpp b/src/main.cpp index f0e5183e98..9e5f743b69 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -52,6 +52,8 @@ multimap<uint256, CBlock*> mapOrphanBlocksByPrev; map<uint256, CDataStream*> mapOrphanTransactions; multimap<uint256, CDataStream*> mapOrphanTransactionsByPrev; +// Constant stuff for coinbase transactions we create: +CScript COINBASE_FLAGS; const string strMessageMagic = "Bitcoin Signed Message:\n"; @@ -1213,8 +1215,9 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex) // To avoid being on the short end of a block-chain split, // don't do secondary validation of pay-to-script-hash transactions - // until blocks with timestamps after paytoscripthashtime: - int64 nEvalSwitchTime = GetArg("-paytoscripthashtime", 1329264000); // Feb 15, 2012 + // until blocks with timestamps after paytoscripthashtime (see init.cpp for default). + // This code can be removed once a super-majority of the network has upgraded. + int64 nEvalSwitchTime = GetArg("-paytoscripthashtime", std::numeric_limits<int64_t>::max()); bool fStrictPayToScriptHash = (pindex->nTime >= nEvalSwitchTime); //// issue here: it doesn't know the version diff --git a/src/main.h b/src/main.h index 825c81e485..38cdd81fcc 100644 --- a/src/main.h +++ b/src/main.h @@ -49,10 +49,7 @@ static const int fHaveUPnP = false; #endif -// 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<unsigned char>(pszP2SH, pszP2SH+strlen(pszP2SH)); +extern CScript COINBASE_FLAGS; diff --git a/src/util.cpp b/src/util.cpp index 6a4c2a2ef3..049297706c 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -488,7 +488,7 @@ bool SoftSetArg(const std::string& strArg, const std::string& strValue) return true; } -bool SoftSetArg(const std::string& strArg, bool fValue) +bool SoftSetBoolArg(const std::string& strArg, bool fValue) { if (fValue) return SoftSetArg(strArg, std::string("1")); diff --git a/src/util.h b/src/util.h index 19f06521ef..8f86ba0180 100644 --- a/src/util.h +++ b/src/util.h @@ -442,7 +442,7 @@ bool SoftSetArg(const std::string& strArg, const std::string& strValue); * @param fValue Value (e.g. false) * @return true if argument gets set, false if it already had a value */ -bool SoftSetArg(const std::string& strArg, bool fValue); +bool SoftSetBoolArg(const std::string& strArg, bool fValue); |