Browse Source

Merge remote branch 'refs/remotes/svn/trunk' into svn

0.8
Gavin Andresen 14 years ago
parent
commit
d12e53ea09
  1. 20
      main.cpp
  2. 11
      main.h
  3. 9
      script.cpp
  4. 18
      script.h
  5. 2
      serialize.h
  6. 6
      setup.nsi
  7. 4
      sha256.cpp
  8. 5
      util.cpp

20
main.cpp

@ -572,7 +572,7 @@ bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMi @@ -572,7 +572,7 @@ bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMi
return error("AcceptToMemoryPool() : not accepting nLockTime beyond 2038 yet");
// Rather not work on nonstandard transactions
if (GetSigOpCount() > 2 || ::GetSerializeSize(*this, SER_NETWORK) < 100)
if (!IsStandard() || GetSigOpCount() > 2 || ::GetSerializeSize(*this, SER_NETWORK) < 100)
return error("AcceptToMemoryPool() : nonstandard transaction");
// Do we already have it?
@ -2567,15 +2567,17 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) @@ -2567,15 +2567,17 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
else if (strCommand == "checkorder")
{
uint256 hashReply;
CWalletTx order;
vRecv >> hashReply >> order;
vRecv >> hashReply;
if (!mapArgs.count("-allowreceivebyip") || mapArgs["-allowreceivebyip"] == "0")
if (!GetBoolArg("-allowreceivebyip"))
{
pfrom->PushMessage("reply", hashReply, (int)2, string(""));
return true;
}
CWalletTx order;
vRecv >> order;
/// we have a chance to check the order here
// Keep giving the same key to the same ip until they use it
@ -2592,16 +2594,18 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) @@ -2592,16 +2594,18 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
else if (strCommand == "submitorder")
{
uint256 hashReply;
CWalletTx wtxNew;
vRecv >> hashReply >> wtxNew;
wtxNew.fFromMe = false;
vRecv >> hashReply;
if (!mapArgs.count("-allowreceivebyip") || mapArgs["-allowreceivebyip"] == "0")
if (!GetBoolArg("-allowreceivebyip"))
{
pfrom->PushMessage("reply", hashReply, (int)2);
return true;
}
CWalletTx wtxNew;
vRecv >> wtxNew;
wtxNew.fFromMe = false;
// Broadcast
if (!wtxNew.AcceptWalletTransaction())
{

11
main.h

@ -499,6 +499,17 @@ public: @@ -499,6 +499,17 @@ public:
return n;
}
bool IsStandard() const
{
foreach(const CTxIn& txin, vin)
if (!txin.scriptSig.IsPushOnly())
return error("nonstandard txin: %s", txin.scriptSig.ToString().c_str());
foreach(const CTxOut& txout, vout)
if (!::IsStandard(txout.scriptPubKey))
return error("nonstandard txout: %s", txout.scriptPubKey.ToString().c_str());
return true;
}
bool IsMine() const
{
foreach(const CTxOut& txout, vout)

9
script.cpp

@ -997,7 +997,7 @@ bool Solver(const CScript& scriptPubKey, vector<pair<opcodetype, valtype> >& vSo @@ -997,7 +997,7 @@ bool Solver(const CScript& scriptPubKey, vector<pair<opcodetype, valtype> >& vSo
break;
if (opcode2 == OP_PUBKEY)
{
if (vch1.size() < 33)
if (vch1.size() < 33 || vch1.size() > 120)
break;
vSolutionRet.push_back(make_pair(opcode2, vch1));
}
@ -1076,6 +1076,13 @@ bool Solver(const CScript& scriptPubKey, uint256 hash, int nHashType, CScript& s @@ -1076,6 +1076,13 @@ bool Solver(const CScript& scriptPubKey, uint256 hash, int nHashType, CScript& s
}
bool IsStandard(const CScript& scriptPubKey)
{
vector<pair<opcodetype, valtype> > vSolution;
return Solver(scriptPubKey, vSolution);
}
bool IsMine(const CScript& scriptPubKey)
{
CScript scriptSig;

18
script.h

@ -597,6 +597,23 @@ public: @@ -597,6 +597,23 @@ public:
}
bool IsPushOnly() const
{
if (size() > 200)
return false;
const_iterator pc = begin();
while (pc < end())
{
opcodetype opcode;
if (!GetOp(pc, opcode))
return false;
if (opcode > OP_16)
return false;
}
return true;
}
uint160 GetBitcoinAddressHash160() const
{
opcodetype opcode;
@ -684,6 +701,7 @@ public: @@ -684,6 +701,7 @@ public:
uint256 SignatureHash(CScript scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType);
bool IsStandard(const CScript& scriptPubKey);
bool IsMine(const CScript& scriptPubKey);
bool ExtractPubKey(const CScript& scriptPubKey, bool fMineOnly, vector<unsigned char>& vchPubKeyRet);
bool ExtractHash160(const CScript& scriptPubKey, uint160& hash160Ret);

2
serialize.h

@ -25,7 +25,7 @@ class CDataStream; @@ -25,7 +25,7 @@ class CDataStream;
class CAutoFile;
static const unsigned int MAX_SIZE = 0x02000000;
static const int VERSION = 31704;
static const int VERSION = 31800;
static const char* pszSubVer = "";

6
setup.nsi

@ -7,7 +7,7 @@ RequestExecutionLevel highest @@ -7,7 +7,7 @@ RequestExecutionLevel highest
# General Symbol Definitions
!define REGKEY "SOFTWARE\$(^Name)"
!define VERSION 0.3.17
!define VERSION 0.3.18
!define COMPANY "Bitcoin project"
!define URL http://www.bitcoin.org/
@ -42,12 +42,12 @@ Var StartMenuGroup @@ -42,12 +42,12 @@ Var StartMenuGroup
!insertmacro MUI_LANGUAGE English
# Installer attributes
OutFile bitcoin-0.3.17-win32-setup.exe
OutFile bitcoin-0.3.18-win32-setup.exe
InstallDir $PROGRAMFILES\Bitcoin
CRCCheck on
XPStyle on
ShowInstDetails show
VIProductVersion 0.3.17.0
VIProductVersion 0.3.18.0
VIAddVersionKey ProductName Bitcoin
VIAddVersionKey ProductVersion "${VERSION}"
VIAddVersionKey CompanyName "${COMPANY}"

4
sha256.cpp

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
// Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2010 Nils Schneider
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
// tcatm's 4-way 128-bit SSE2 SHA-256
// 4-way 128-bit SSE2 SHA-256
#ifdef FOURWAYSSE2

5
util.cpp

@ -175,7 +175,6 @@ inline int OutputDebugStringF(const char* pszFormat, ...) @@ -175,7 +175,6 @@ inline int OutputDebugStringF(const char* pszFormat, ...)
va_start(arg_ptr, pszFormat);
ret = vfprintf(fileout, pszFormat, arg_ptr);
va_end(arg_ptr);
fflush(fileout);
}
}
@ -406,11 +405,11 @@ vector<unsigned char> ParseHex(const char* psz) @@ -406,11 +405,11 @@ vector<unsigned char> ParseHex(const char* psz)
while (isspace(*psz))
psz++;
char c = phexdigit[(unsigned char)*psz++];
if (c == -1)
if (c == (char)-1)
break;
unsigned char n = (c << 4);
c = phexdigit[(unsigned char)*psz++];
if (c == -1)
if (c == (char)-1)
break;
n |= c;
vch.push_back(n);

Loading…
Cancel
Save