Merge branch 'master' of github.com:jedmccaleb/NewCoin

This commit is contained in:
Arthur Britto
2013-04-01 19:21:36 -07:00
7 changed files with 237 additions and 10 deletions

View File

@@ -158,7 +158,13 @@ STAmount::STAmount(SField::ref n, const Json::Value& v)
mIsNative = !currency.isString() || currency.asString().empty() || (currency.asString() == SYSTEM_CURRENCY_CODE);
if (!mIsNative) {
if (mIsNative)
{
if (v.isObject())
throw std::runtime_error("XRP may not be specified as an object");
}
else
{ // non-XRP
if (!currencyFromString(mCurrency, currency.asString()))
throw std::runtime_error("invalid currency");

View File

@@ -582,7 +582,7 @@ bool SHAMap::addGiveItem(SHAMapItem::ref item, bool isTransaction, bool hasMeta)
stack.pop();
if (node->isLeaf() && (node->peekItem()->getTag() == tag))
throw std::runtime_error("addGiveItem ends on leaf with same tag");
return false;
uint256 prevHash;
returnNode(node, true);

View File

@@ -7,5 +7,10 @@
bool TransactionEngine::checkInvariants(TER result, const SerializedTransaction& txn, TransactionEngineParams params)
{
// 1) Make sure transaction changed account sequence number to correct value
// 2) Make sure transaction didn't create XRP
return true;
}

View File

@@ -176,12 +176,20 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
if (isSetBit(params, tapOPEN_LEDGER))
{
if (!mLedger->addTransaction(txID, s))
{
cLog(lsFATAL) << "Tried to add transaction to open ledger that already had it";
assert(false);
throw std::runtime_error("Duplicate transaction applied");
}
}
else
{
if (!mLedger->addTransaction(txID, s, m))
assert(false);
{
cLog(lsFATAL) << "Tried to add transaction to ledger that already had it";
assert(false);
throw std::runtime_error("Duplicate transaction applied to closed ledger");
}
// Charge whatever fee they specified.
STAmount saPaid = txn.getTransactionFee();

View File

@@ -142,7 +142,8 @@ TER Transactor::checkSeq()
cLog(lsWARNING) << "applyTransaction: past sequence number";
return tefPAST_SEQ;
}else
}
else
{
mTxnAccount->setFieldU32(sfSequence, t_seq + 1);
}