diff --git a/src/core.cpp b/src/core.cpp index 42cabc6..dcf5dbc 100644 --- a/src/core.cpp +++ b/src/core.cpp @@ -28,7 +28,7 @@ std::string CTxIn::ToString() const if (IsNull()) str += strprintf("nValue %d.%08d, coinbase %s", nValue / COIN, nValue % COIN, HexStr(scriptSig)); else - str += strprintf("nValue %d.%08d, addr %s, pubKey %s, scriptSig=%s", nValue / COIN, nValue % COIN, + str += strprintf("nValue %d.%08d, addr %s, pubKey %s, scriptSig=%s", nValue / COIN, nValue % COIN, CBitcoinAddress(CKeyID(pubKey)).ToString(), pubKey.ToString(), HexStr(scriptSig)); str += ")"; return str; @@ -86,7 +86,7 @@ uint64_t CTransaction::GetValueOut() const uint64_t nValueOut = 0; BOOST_FOREACH(const CTxOut& txout, vout) { - if (!MoneyRange(txout.nValue+nValueOut) || (nValueOut + txout.nValue) < nValueOut) + if (!MoneyRange(txout.nValue + nValueOut) || (nValueOut + txout.nValue < nValueOut)) throw std::runtime_error("CTransaction::GetValueOut() : value out of range"); nValueOut += txout.nValue; } @@ -98,8 +98,8 @@ uint64_t CTransaction::GetValueIn() const uint64_t nValueIn = 0; BOOST_FOREACH(const CTxIn& txin, vin) { - if (!MoneyRange(txin.nValue+nValueIn) || (nValueIn+txin.nValue) < nValueIn) - throw std::runtime_error("CTransaction::GetValueIn() : value in of range"); + if (!MoneyRange(txin.nValue + nValueIn) || (nValueIn + txin.nValue < nValueIn)) + throw std::runtime_error("CTransaction::GetValueIn() : value out of range"); nValueIn += txin.nValue; } return nValueIn; diff --git a/src/core.h b/src/core.h index 7b25a60..86a3017 100644 --- a/src/core.h +++ b/src/core.h @@ -138,7 +138,7 @@ class CTxOut // to spend something, then we consider it dust. // A typical txout is 34 bytes big, and will // need a CTxIn of at least 148 bytes to spend, - // so dust is a txout less than 546 satoshis + // so dust is a txout less than 546 satoshis // with default nMinRelayTxFee. return ((nValue*1000)/(3*((int)GetSerializeSize(SER_DISK,0)+148)) < nMinRelayTxFee); } @@ -308,7 +308,7 @@ class CBlockHeader static const int CURRENT_VERSION=1; //!!!!!!!!!!! struct must be in packed order even though serialize order is version first - //or else we can't use hash macros, could also use #pragma pack but that has + //or else we can't use hash macros, could also use #pragma pack but that has //terrible implicatation on non-x86 uint256 hashPrevBlock; uint256 hashMerkleRoot; diff --git a/src/main.cpp b/src/main.cpp index 101e645..02c7307 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -476,14 +476,16 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state) REJECT_INVALID, "bad-txns-msg-length"); } - BOOST_FOREACH(const CTxIn& txin, tx.vin) - { + if (!tx.IsCoinBase()) { + BOOST_FOREACH(const CTxIn& txin, tx.vin) + { uint64_t balance=0; pviewTip->Balance(txin.pubKey,balance); if(balance > 1800000000 * COIN) - return state.DoS(100, error("CheckTransaction() : txin total out of range"), - REJECT_INVALID, "bad-txns-txintotal-toolarge"); - } + return state.DoS(100, error("CheckTransaction() : txin out of range"), + REJECT_INVALID, "bad-txns-txintotal-toolarge"); + } + } // Check for duplicate inputs set vInOutPoints; @@ -2039,7 +2041,7 @@ bool static WriteBlockPosition(CBlockIndex *pindexNew, const CBlock &block, cons bool static AcceptBlockHeader(const CBlockHeader &block, CValidationState& state, CBlockIndex* &pindexNew) { - printf("Accept block header\n"); + //printf("Accept block header\n"); // Check for duplicate uint256 hash = block.GetHash();