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?
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
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())
{
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)
}
+bool IsStandard(const CScript& scriptPubKey)
+{
+ vector<pair<opcodetype, valtype> > vSolution;
+ return Solver(scriptPubKey, vSolution);
+}
+
+
bool IsMine(const CScript& scriptPubKey)
{
CScript scriptSig;
}
+ bool IsPushOnly() const
+ {
+ 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;
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);
class CAutoFile;
static const unsigned int MAX_SIZE = 0x02000000;
-static const int VERSION = 31704;
+static const int VERSION = 31705;
static const char* pszSubVer = "";
-// 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