Browse Source

remove stuff

miguelfreitas
Miguel Freitas 12 years ago
parent
commit
1c4f457312
  1. 67
      src/main.cpp
  2. 20
      src/main.h

67
src/main.cpp

@ -109,14 +109,6 @@ bool static GetTransaction(const uint256& hashTx, CWalletTx& wtx)
return false; return false;
} }
// erases transaction with the given hash from all wallets
void static EraseFromWallets(uint256 hash)
{
LOCK(cs_setpwalletRegistered);
BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
pwallet->EraseFromWallet(hash);
}
// make sure all wallets know about the given transaction, in the given block // make sure all wallets know about the given transaction, in the given block
void SyncWithWallets(const uint256 &hash, const CTransaction& tx, const CBlock* pblock, bool fUpdate) void SyncWithWallets(const uint256 &hash, const CTransaction& tx, const CBlock* pblock, bool fUpdate)
{ {
@ -669,7 +661,6 @@ bool CWalletTx::AcceptWalletTransaction()
// Return transaction in tx, and if it was found inside a block, its hash is placed in hashBlock // Return transaction in tx, and if it was found inside a block, its hash is placed in hashBlock
bool GetTransaction(const uint256 &userhash, CTransaction &txOut, uint256 &hashBlock, bool fAllowSlow) bool GetTransaction(const uint256 &userhash, CTransaction &txOut, uint256 &hashBlock, bool fAllowSlow)
{ {
CBlockIndex *pindexSlow = NULL;
{ {
LOCK(cs_main); LOCK(cs_main);
{ {
@ -1020,59 +1011,6 @@ void UpdateTime(CBlockHeader& block, const CBlockIndex* pindexPrev)
/*
const CTxOut &CCoinsViewCache::GetOutputFor(const CTxIn& input)
{
const CCoins &coins = GetCoins(input.prevout.hash);
assert(coins.IsAvailable(input.prevout.n));
return coins.vout[input.prevout.n];
}
*/
int64 CCoinsViewCache::GetValueIn(const CTransaction& tx)
{
if (tx.IsSpamMessage())
return 0;
int64 nResult = 0;
/* [MF]
for (unsigned int i = 0; i < tx.vin.size(); i++)
nResult += GetOutputFor(tx.vin[i]).nValue;
*/
return nResult;
}
void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCache &inputs, CTxUndo &txundo, int nHeight, const uint256 &txhash)
{
// mark inputs spent
if (!tx.IsSpamMessage()) {
/* [MF]
BOOST_FOREACH(const CTxIn &txin, tx.vin) {
CCoins &coins = inputs.GetCoins(txin.prevout.hash);
CTxInUndo undo;
assert(coins.Spend(txin.prevout, undo));
txundo.vprevout.push_back(undo);
}
*/
}
// add outputs
assert(inputs.SetCoins(txhash, CCoins(tx, nHeight)));
}
bool CCoinsViewCache::HaveInputs(const CTransaction& tx)
{
return true;
}
bool VerifySignature(const CCoins& txFrom, const CTransaction& txTo, unsigned int nIn, unsigned int flags, int nHashType)
{
/* [MF]
return CScriptCheck(txFrom, txTo, nIn, flags, nHashType)();
*/
return true;
}
bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& view, bool* pfClean) bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& view, bool* pfClean)
{ {
@ -3623,11 +3561,6 @@ CBlockTemplate* CreateNewBlock(CReserveKey& reservekey)
if (nBlockSize + nTxSize >= nBlockMaxSize) if (nBlockSize + nTxSize >= nBlockMaxSize)
continue; continue;
CValidationState state;
CTxUndo txundo;
uint256 hash = tx.GetUsernameHash();
UpdateCoins(tx, state, view, txundo, pindexPrev->nHeight+1, hash);
// Added // Added
pblock->vtx.push_back(tx); pblock->vtx.push_back(tx);
nBlockSize += nTxSize; nBlockSize += nTxSize;

20
src/main.h

@ -194,8 +194,6 @@ void UpdateTime(CBlockHeader& block, const CBlockIndex* pindexPrev);
/** Create a new block index entry for a given block hash */ /** Create a new block index entry for a given block hash */
CBlockIndex * InsertBlockIndex(uint256 hash); CBlockIndex * InsertBlockIndex(uint256 hash);
/** Verify a signature */
bool VerifySignature(const CCoins& txFrom, const CTransaction& txTo, unsigned int nIn, unsigned int flags, int nHashType);
/** Abort with a message */ /** Abort with a message */
bool AbortNode(const std::string &msg); bool AbortNode(const std::string &msg);
@ -272,9 +270,6 @@ inline bool AllowFree(double dPriority)
return dPriority > COIN * 144 / 250; return dPriority > COIN * 144 / 250;
} }
// Apply the effects of this transaction on the UTXO set represented by view
bool UpdateCoins(const CTransaction& tx, CCoinsViewCache &view, CTxUndo &txundo, int nHeight, const uint256 &txhash);
// Context-independent validity checks // Context-independent validity checks
bool CheckTransaction(const CTransaction& tx, CValidationState& state); bool CheckTransaction(const CTransaction& tx, CValidationState& state);
@ -1124,21 +1119,6 @@ public:
// Calculate the size of the cache (in number of transactions) // Calculate the size of the cache (in number of transactions)
unsigned int GetCacheSize(); unsigned int GetCacheSize();
/** Amount of bitcoins coming in to a transaction
Note that lightweight clients may not know anything besides the hash of previous transactions,
so may not be able to calculate this.
@param[in] tx transaction for which we are checking input total
@return Sum of value of all inputs (scriptSigs)
@see CTransaction::FetchInputs
*/
int64 GetValueIn(const CTransaction& tx);
// Check whether all prevouts of the transaction are present in the UTXO set represented by this view
bool HaveInputs(const CTransaction& tx);
//const CTxOut &GetOutputFor(const CTxIn& input);
private: private:
std::map<uint256,CCoins>::iterator FetchCoins(const uint256 &txid); std::map<uint256,CCoins>::iterator FetchCoins(const uint256 &txid);
}; };

Loading…
Cancel
Save