mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-23 04:54:30 +00:00
removing stuff
This commit is contained in:
parent
e70fafc0f9
commit
7a47376e40
@ -489,12 +489,6 @@ bool AppInit2(boost::thread_group& threadGroup)
|
|||||||
if (fDaemon)
|
if (fDaemon)
|
||||||
fprintf(stdout, "Bitcoin server starting\n");
|
fprintf(stdout, "Bitcoin server starting\n");
|
||||||
|
|
||||||
if (nScriptCheckThreads) {
|
|
||||||
printf("Using %u threads for script verification\n", nScriptCheckThreads);
|
|
||||||
for (int i=0; i<nScriptCheckThreads-1; i++)
|
|
||||||
threadGroup.create_thread(&ThreadScriptCheck);
|
|
||||||
}
|
|
||||||
|
|
||||||
int64 nStart;
|
int64 nStart;
|
||||||
|
|
||||||
// ********************************************************* Step 5: verify wallet database integrity
|
// ********************************************************* Step 5: verify wallet database integrity
|
||||||
|
104
src/main.cpp
104
src/main.cpp
@ -408,103 +408,6 @@ bool IsStandardTx(const CTransaction& tx, string& reason)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Check transaction inputs, and make sure any
|
|
||||||
// pay-to-script-hash transactions are evaluating IsStandard scripts
|
|
||||||
//
|
|
||||||
// Why bother? To avoid denial-of-service attacks; an attacker
|
|
||||||
// can submit a standard HASH... OP_EQUAL transaction,
|
|
||||||
// which will get accepted into blocks. The redemption
|
|
||||||
// script can be anything; an attacker could use a very
|
|
||||||
// expensive-to-check-upon-redemption script like:
|
|
||||||
// DUP CHECKSIG DROP ... repeated 100 times... OP_1
|
|
||||||
//
|
|
||||||
bool AreInputsStandard(const CTransaction& tx, CCoinsViewCache& mapInputs)
|
|
||||||
{
|
|
||||||
if (tx.IsSpamMessage())
|
|
||||||
return true; // Coinbases don't use vin normally
|
|
||||||
/* [MF]
|
|
||||||
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
|
||||||
{
|
|
||||||
const CTxOut& prev = mapInputs.GetOutputFor(tx.vin[i]);
|
|
||||||
|
|
||||||
vector<vector<unsigned char> > vSolutions;
|
|
||||||
txnouttype whichType;
|
|
||||||
// get the scriptPubKey corresponding to this input:
|
|
||||||
const CScript& prevScript = prev.scriptPubKey;
|
|
||||||
if (!Solver(prevScript, whichType, vSolutions))
|
|
||||||
return false;
|
|
||||||
int nArgsExpected = ScriptSigArgsExpected(whichType, vSolutions);
|
|
||||||
if (nArgsExpected < 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Transactions with extra stuff in their scriptSigs are
|
|
||||||
// non-standard. Note that this EvalScript() call will
|
|
||||||
// be quick, because if there are any operations
|
|
||||||
// beside "push data" in the scriptSig the
|
|
||||||
// IsStandard() call returns false
|
|
||||||
vector<vector<unsigned char> > stack;
|
|
||||||
if (!EvalScript(stack, tx.vin[i].scriptSig, tx, i, false, 0))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (whichType == TX_SCRIPTHASH)
|
|
||||||
{
|
|
||||||
if (stack.empty())
|
|
||||||
return false;
|
|
||||||
CScript subscript(stack.back().begin(), stack.back().end());
|
|
||||||
vector<vector<unsigned char> > vSolutions2;
|
|
||||||
txnouttype whichType2;
|
|
||||||
if (!Solver(subscript, whichType2, vSolutions2))
|
|
||||||
return false;
|
|
||||||
if (whichType2 == TX_SCRIPTHASH)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
int tmpExpected;
|
|
||||||
tmpExpected = ScriptSigArgsExpected(whichType2, vSolutions2);
|
|
||||||
if (tmpExpected < 0)
|
|
||||||
return false;
|
|
||||||
nArgsExpected += tmpExpected;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stack.size() != (unsigned int)nArgsExpected)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int GetLegacySigOpCount(const CTransaction& tx)
|
|
||||||
{
|
|
||||||
unsigned int nSigOps = 0;
|
|
||||||
/*
|
|
||||||
BOOST_FOREACH(const CTxIn& txin, tx.vin)
|
|
||||||
{
|
|
||||||
nSigOps += txin.scriptSig.GetSigOpCount(false);
|
|
||||||
}
|
|
||||||
BOOST_FOREACH(const CTxOut& txout, tx.vout)
|
|
||||||
{
|
|
||||||
nSigOps += txout.scriptPubKey.GetSigOpCount(false);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return nSigOps;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int GetP2SHSigOpCount(const CTransaction& tx, CCoinsViewCache& inputs)
|
|
||||||
{
|
|
||||||
if (tx.IsSpamMessage())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
unsigned int nSigOps = 0;
|
|
||||||
/*
|
|
||||||
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
|
||||||
{
|
|
||||||
const CTxOut &prevout = inputs.GetOutputFor(tx.vin[i]);
|
|
||||||
if (prevout.scriptPubKey.IsPayToScriptHash())
|
|
||||||
nSigOps += prevout.scriptPubKey.GetSigOpCount(tx.vin[i].scriptSig);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return nSigOps;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CMerkleTx::SetMerkleBranch(const CBlock* pblock)
|
int CMerkleTx::SetMerkleBranch(const CBlock* pblock)
|
||||||
{
|
{
|
||||||
@ -1385,13 +1288,6 @@ void static FlushBlockFile(bool fFinalize = false)
|
|||||||
|
|
||||||
bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize);
|
bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize);
|
||||||
|
|
||||||
static CCheckQueue<CScriptCheck> scriptcheckqueue(128);
|
|
||||||
|
|
||||||
void ThreadScriptCheck() {
|
|
||||||
RenameThread("bitcoin-scriptch");
|
|
||||||
scriptcheckqueue.Thread();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& view, bool fJustCheck)
|
bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& view, bool fJustCheck)
|
||||||
{
|
{
|
||||||
// Check it again in case a previous version let a bad block in
|
// Check it again in case a previous version let a bad block in
|
||||||
|
66
src/main.h
66
src/main.h
@ -114,7 +114,6 @@ class CCoins;
|
|||||||
class CTxUndo;
|
class CTxUndo;
|
||||||
class CCoinsView;
|
class CCoinsView;
|
||||||
class CCoinsViewCache;
|
class CCoinsViewCache;
|
||||||
class CScriptCheck;
|
|
||||||
class CValidationState;
|
class CValidationState;
|
||||||
|
|
||||||
struct CBlockTemplate;
|
struct CBlockTemplate;
|
||||||
@ -161,8 +160,6 @@ CBlockIndex* FindBlockByHeight(int nHeight);
|
|||||||
bool ProcessMessages(CNode* pfrom);
|
bool ProcessMessages(CNode* pfrom);
|
||||||
/** Send queued protocol messages to be sent to a give node */
|
/** Send queued protocol messages to be sent to a give node */
|
||||||
bool SendMessages(CNode* pto, bool fSendTrickle);
|
bool SendMessages(CNode* pto, bool fSendTrickle);
|
||||||
/** Run an instance of the script checking thread */
|
|
||||||
void ThreadScriptCheck();
|
|
||||||
/** Run the miner threads */
|
/** Run the miner threads */
|
||||||
void GenerateBitcoins(bool fGenerate, CWallet* pwallet);
|
void GenerateBitcoins(bool fGenerate, CWallet* pwallet);
|
||||||
/** Generate a new block, without valid proof-of-work */
|
/** Generate a new block, without valid proof-of-work */
|
||||||
@ -265,40 +262,6 @@ struct CDiskTxPos : public CDiskBlockPos
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check transaction inputs, and make sure any
|
|
||||||
// pay-to-script-hash transactions are evaluating IsStandard scripts
|
|
||||||
//
|
|
||||||
// Why bother? To avoid denial-of-service attacks; an attacker
|
|
||||||
// can submit a standard HASH... OP_EQUAL transaction,
|
|
||||||
// which will get accepted into blocks. The redemption
|
|
||||||
// script can be anything; an attacker could use a very
|
|
||||||
// expensive-to-check-upon-redemption script like:
|
|
||||||
// DUP CHECKSIG DROP ... repeated 100 times... OP_1
|
|
||||||
//
|
|
||||||
|
|
||||||
/** Check for standard transaction types
|
|
||||||
@param[in] mapInputs Map of previous transactions that have outputs we're spending
|
|
||||||
@return True if all inputs (scriptSigs) use only standard transaction forms
|
|
||||||
*/
|
|
||||||
bool AreInputsStandard(const CTransaction& tx, CCoinsViewCache& mapInputs);
|
|
||||||
|
|
||||||
/** Count ECDSA signature operations the old-fashioned (pre-0.6) way
|
|
||||||
@return number of sigops this transaction's outputs will produce when spent
|
|
||||||
@see CTransaction::FetchInputs
|
|
||||||
*/
|
|
||||||
unsigned int GetLegacySigOpCount(const CTransaction& tx);
|
|
||||||
|
|
||||||
/** Count ECDSA signature operations in pay-to-script-hash inputs.
|
|
||||||
|
|
||||||
@param[in] mapInputs Map of previous transactions that have outputs we're spending
|
|
||||||
@return maximum number of sigops required to validate this transaction's inputs
|
|
||||||
@see CTransaction::FetchInputs
|
|
||||||
*/
|
|
||||||
unsigned int GetP2SHSigOpCount(const CTransaction& tx, CCoinsViewCache& mapInputs);
|
|
||||||
|
|
||||||
|
|
||||||
inline bool AllowFree(double dPriority)
|
inline bool AllowFree(double dPriority)
|
||||||
{
|
{
|
||||||
// Large (in bytes) low-priority (new, small-coin) transactions
|
// Large (in bytes) low-priority (new, small-coin) transactions
|
||||||
@ -388,35 +351,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** Closure representing one script verification
|
|
||||||
* Note that this stores references to the spending transaction */
|
|
||||||
class CScriptCheck
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
CScript scriptPubKey;
|
|
||||||
const CTransaction *ptxTo;
|
|
||||||
unsigned int nIn;
|
|
||||||
unsigned int nFlags;
|
|
||||||
int nHashType;
|
|
||||||
|
|
||||||
public:
|
|
||||||
CScriptCheck() {}
|
|
||||||
CScriptCheck(const CCoins& txFromIn, const CTransaction& txToIn, unsigned int nInIn, unsigned int nFlagsIn, int nHashTypeIn) :
|
|
||||||
// scriptPubKey(txFromIn.vout[txToIn.vin[nInIn].prevout.n].scriptPubKey), [MF]
|
|
||||||
scriptPubKey(),
|
|
||||||
ptxTo(&txToIn), nIn(nInIn), nFlags(nFlagsIn), nHashType(nHashTypeIn) { }
|
|
||||||
|
|
||||||
bool operator()() const;
|
|
||||||
|
|
||||||
void swap(CScriptCheck &check) {
|
|
||||||
scriptPubKey.swap(check.scriptPubKey);
|
|
||||||
std::swap(ptxTo, check.ptxTo);
|
|
||||||
std::swap(nIn, check.nIn);
|
|
||||||
std::swap(nFlags, check.nFlags);
|
|
||||||
std::swap(nHashType, check.nHashType);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/** A transaction with a merkle branch linking it to the block chain. */
|
/** A transaction with a merkle branch linking it to the block chain. */
|
||||||
class CMerkleTx : public CTransaction
|
class CMerkleTx : public CTransaction
|
||||||
{
|
{
|
||||||
|
@ -34,9 +34,6 @@ struct TestingSetup {
|
|||||||
pwalletMain = new CWallet("wallet.dat");
|
pwalletMain = new CWallet("wallet.dat");
|
||||||
pwalletMain->LoadWallet(fFirstRun);
|
pwalletMain->LoadWallet(fFirstRun);
|
||||||
RegisterWallet(pwalletMain);
|
RegisterWallet(pwalletMain);
|
||||||
nScriptCheckThreads = 3;
|
|
||||||
for (int i=0; i < nScriptCheckThreads-1; i++)
|
|
||||||
threadGroup.create_thread(&ThreadScriptCheck);
|
|
||||||
}
|
}
|
||||||
~TestingSetup()
|
~TestingSetup()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user