Browse Source

-bip16 option (default: 1) to support / not support BIP 16. And bumped default BIP16 switchover date from Feb 15 to Mar 1

0.8
Gavin Andresen 13 years ago
parent
commit
7bf8b7c25c
  1. 33
      src/init.cpp
  2. 7
      src/main.cpp
  3. 5
      src/main.h
  4. 2
      src/util.cpp
  5. 2
      src/util.h

33
src/init.cpp

@ -474,19 +474,38 @@ bool AppInit2(int argc, char* argv[])
bool fTor = (fUseProxy && addrProxy.GetPort() == 9050); bool fTor = (fUseProxy && addrProxy.GetPort() == 9050);
if (fTor) 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. // Note: the GetBoolArg() calls for all of these must happen later.
SoftSetArg("-nolisten", true); SoftSetBoolArg("-nolisten", true);
SoftSetArg("-noirc", true); SoftSetBoolArg("-noirc", true);
SoftSetArg("-nodnsseed", true); SoftSetBoolArg("-nodnsseed", true);
SoftSetArg("-noupnp", true); SoftSetBoolArg("-noupnp", true);
SoftSetArg("-upnp", false); SoftSetBoolArg("-upnp", false);
SoftSetArg("-dns", false); SoftSetBoolArg("-dns", false);
} }
fAllowDNS = GetBoolArg("-dns"); fAllowDNS = GetBoolArg("-dns");
fNoListen = GetBoolArg("-nolisten"); 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: // Command-line args override in-wallet settings:
if (mapArgs.count("-upnp")) if (mapArgs.count("-upnp"))
fUseUPnP = GetBoolArg("-upnp"); fUseUPnP = GetBoolArg("-upnp");

7
src/main.cpp

@ -52,6 +52,8 @@ multimap<uint256, CBlock*> mapOrphanBlocksByPrev;
map<uint256, CDataStream*> mapOrphanTransactions; map<uint256, CDataStream*> mapOrphanTransactions;
multimap<uint256, CDataStream*> mapOrphanTransactionsByPrev; multimap<uint256, CDataStream*> mapOrphanTransactionsByPrev;
// Constant stuff for coinbase transactions we create:
CScript COINBASE_FLAGS;
const string strMessageMagic = "Bitcoin Signed Message:\n"; 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, // To avoid being on the short end of a block-chain split,
// don't do secondary validation of pay-to-script-hash transactions // don't do secondary validation of pay-to-script-hash transactions
// until blocks with timestamps after paytoscripthashtime: // until blocks with timestamps after paytoscripthashtime (see init.cpp for default).
int64 nEvalSwitchTime = GetArg("-paytoscripthashtime", 1329264000); // Feb 15, 2012 // 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); bool fStrictPayToScriptHash = (pindex->nTime >= nEvalSwitchTime);
//// issue here: it doesn't know the version //// issue here: it doesn't know the version

5
src/main.h

@ -49,10 +49,7 @@ static const int fHaveUPnP = false;
#endif #endif
// Put "/P2SH/" in the coinbase so everybody can tell when extern CScript COINBASE_FLAGS;
// 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));

2
src/util.cpp

@ -488,7 +488,7 @@ bool SoftSetArg(const std::string& strArg, const std::string& strValue)
return true; return true;
} }
bool SoftSetArg(const std::string& strArg, bool fValue) bool SoftSetBoolArg(const std::string& strArg, bool fValue)
{ {
if (fValue) if (fValue)
return SoftSetArg(strArg, std::string("1")); return SoftSetArg(strArg, std::string("1"));

2
src/util.h

@ -442,7 +442,7 @@ bool SoftSetArg(const std::string& strArg, const std::string& strValue);
* @param fValue Value (e.g. false) * @param fValue Value (e.g. false)
* @return true if argument gets set, false if it already had a value * @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);

Loading…
Cancel
Save