Rename trans engine never prefix to ten.

This commit is contained in:
Arthur Britto
2012-05-13 11:59:02 -07:00
parent bc8eff1bf5
commit 66a77d2937
4 changed files with 34 additions and 29 deletions

View File

@@ -427,3 +427,4 @@ bool LedgerAcquireMaster::gotLedgerData(newcoin::TMLedgerData& packet, Peer::poi
return false; return false;
} }
// vim:ts=4

View File

@@ -54,7 +54,7 @@ Transaction::pointer NetworkOPs::processTransaction(Transaction::pointer trans,
} }
TransactionEngineResult r = theApp->getMasterLedger().doTransaction(*trans->getSTransaction(), tepNONE); TransactionEngineResult r = theApp->getMasterLedger().doTransaction(*trans->getSTransaction(), tepNONE);
if (r == terFAILED) throw Fault(IO_ERROR); if (r == tenFAILED) throw Fault(IO_ERROR);
if (r == terPRE_SEQ) if (r == terPRE_SEQ)
{ // transaction should be held { // transaction should be held

View File

@@ -9,17 +9,17 @@ TransactionEngineResult TransactionEngine::applyTransaction(const SerializedTran
TransactionEngineResult result = terSUCCESS; TransactionEngineResult result = terSUCCESS;
uint256 txID = txn.getTransactionID(); uint256 txID = txn.getTransactionID();
if(!txID) return terINVALID; if(!txID) return tenINVALID;
// Extract signing key // Extract signing key
// Transactions contain a signing key. This allows us to trivially verify a transaction has at least been properly signed // Transactions contain a signing key. This allows us to trivially verify a transaction has at least been properly signed
// without going to disk. Each transaction also notes a source account id. This is used to verify that the signing key is // without going to disk. Each transaction also notes a source account id. This is used to verify that the signing key is
// associated with the account. // associated with the account.
CKey acctKey; CKey acctKey;
if (!acctKey.SetPubKey(txn.peekSigningPubKey())) return terINVALID; if (!acctKey.SetPubKey(txn.peekSigningPubKey())) return tenINVALID;
// check signature // check signature
if (!txn.checkSign(acctKey)) return terINVALID; if (!txn.checkSign(acctKey)) return tenINVALID;
bool bPrepaid = false; bool bPrepaid = false;
@@ -37,11 +37,11 @@ TransactionEngineResult TransactionEngine::applyTransaction(const SerializedTran
break; break;
case ttINVALID: case ttINVALID:
result = terINVALID; result = tenINVALID;
break; break;
default: default:
result = terUNKNOWN; result = tenUNKNOWN;
break; break;
} }
@@ -55,19 +55,19 @@ TransactionEngineResult TransactionEngine::applyTransaction(const SerializedTran
{ {
if (txnFee) if (txnFee)
// Transaction is malformed. // Transaction is malformed.
return terINSUF_FEE_P; return tenINSUF_FEE_P;
} }
else else
{ {
// WRITEME: Check if fee is adequate // WRITEME: Check if fee is adequate
if (txnFee == 0) if (txnFee == 0)
return terINSUF_FEE_P; return tenINSUF_FEE_P;
} }
} }
// get source account ID // get source account ID
uint160 srcAccount = txn.getSourceAccount().getAccountID(); uint160 srcAccount = txn.getSourceAccount().getAccountID();
if (!srcAccount) return terINVALID; if (!srcAccount) return tenINVALID;
boost::recursive_mutex::scoped_lock sl(mLedger->mLock); boost::recursive_mutex::scoped_lock sl(mLedger->mLock);
@@ -118,7 +118,7 @@ TransactionEngineResult TransactionEngine::applyTransaction(const SerializedTran
switch(txn.getTxnType()) switch(txn.getTxnType())
{ {
case ttINVALID: case ttINVALID:
result = terINVALID; result = tenINVALID;
break; break;
case ttCLAIM: case ttCLAIM:
@@ -138,7 +138,7 @@ TransactionEngineResult TransactionEngine::applyTransaction(const SerializedTran
break; break;
default: default:
result = terUNKNOWN; result = tenUNKNOWN;
break; break;
} }
@@ -183,7 +183,7 @@ TransactionEngineResult TransactionEngine::doClaim(const SerializedTransaction&
if (sourceAccountID != txn.getSourceAccount().getAccountID()) if (sourceAccountID != txn.getSourceAccount().getAccountID())
// Signing Pub Key must be for Source Account ID. // Signing Pub Key must be for Source Account ID.
return terINVALID; return tenINVALID;
LedgerStateParms qry = lepNONE; LedgerStateParms qry = lepNONE;
SerializedLedgerEntry::pointer dest = mLedger->getAccountRoot(qry, sourceAccountID); SerializedLedgerEntry::pointer dest = mLedger->getAccountRoot(qry, sourceAccountID);
@@ -194,14 +194,14 @@ TransactionEngineResult TransactionEngine::doClaim(const SerializedTransaction&
if (dest->getIFieldPresent(sfAuthorizedKey)) if (dest->getIFieldPresent(sfAuthorizedKey))
// Source account already claimed. // Source account already claimed.
return terCLAIMED; return tenCLAIMED;
uint160 hGeneratorID = txn.getITFieldH160(sfGeneratorID); uint160 hGeneratorID = txn.getITFieldH160(sfGeneratorID);
qry = lepNONE; qry = lepNONE;
SerializedLedgerEntry::pointer gen = mLedger->getGenerator(qry, hGeneratorID); SerializedLedgerEntry::pointer gen = mLedger->getGenerator(qry, hGeneratorID);
if (gen) if (gen)
// Generator is already in use. Regular passphrases limited to one wallet. // Generator is already in use. Regular passphrases limited to one wallet.
return terGEN_IN_USE; return tenGEN_IN_USE;
// //
// Claim the account. // Claim the account.
@@ -232,7 +232,7 @@ TransactionEngineResult TransactionEngine::doPayment(const SerializedTransaction
uint160 destAccount = txn.getITFieldAccount(sfDestination); uint160 destAccount = txn.getITFieldAccount(sfDestination);
// Does the destination account exist? // Does the destination account exist?
if (!destAccount) return terINVALID; if (!destAccount) return tenINVALID;
LedgerStateParms qry = lepNONE; LedgerStateParms qry = lepNONE;
SerializedLedgerEntry::pointer dest = mLedger->getAccountRoot(qry, destAccount); SerializedLedgerEntry::pointer dest = mLedger->getAccountRoot(qry, destAccount);
if (!dest) if (!dest)
@@ -265,7 +265,7 @@ TransactionEngineResult TransactionEngine::doPayment(const SerializedTransaction
else else
{ {
// WRITEME: Handle non-native currencies, paths // WRITEME: Handle non-native currencies, paths
return terUNKNOWN; return tenUNKNOWN;
} }
return terSUCCESS; return terSUCCESS;
@@ -274,36 +274,36 @@ TransactionEngineResult TransactionEngine::doPayment(const SerializedTransaction
TransactionEngineResult TransactionEngine::doInvoice(const SerializedTransaction& txn, TransactionEngineResult TransactionEngine::doInvoice(const SerializedTransaction& txn,
std::vector<AffectedAccount>& accounts) std::vector<AffectedAccount>& accounts)
{ {
return terUNKNOWN; return tenUNKNOWN;
} }
TransactionEngineResult TransactionEngine::doOffer(const SerializedTransaction& txn, TransactionEngineResult TransactionEngine::doOffer(const SerializedTransaction& txn,
std::vector<AffectedAccount>& accounts) std::vector<AffectedAccount>& accounts)
{ {
return terUNKNOWN; return tenUNKNOWN;
} }
TransactionEngineResult TransactionEngine::doTake(const SerializedTransaction& txn, TransactionEngineResult TransactionEngine::doTake(const SerializedTransaction& txn,
std::vector<AffectedAccount>& accounts) std::vector<AffectedAccount>& accounts)
{ {
return terUNKNOWN; return tenUNKNOWN;
} }
TransactionEngineResult TransactionEngine::doCancel(const SerializedTransaction& txn, TransactionEngineResult TransactionEngine::doCancel(const SerializedTransaction& txn,
std::vector<AffectedAccount>& accounts) std::vector<AffectedAccount>& accounts)
{ {
return terUNKNOWN; return tenUNKNOWN;
} }
TransactionEngineResult TransactionEngine::doStore(const SerializedTransaction& txn, TransactionEngineResult TransactionEngine::doStore(const SerializedTransaction& txn,
std::vector<AffectedAccount>& accounts) std::vector<AffectedAccount>& accounts)
{ {
return terUNKNOWN; return tenUNKNOWN;
} }
TransactionEngineResult TransactionEngine::doDelete(const SerializedTransaction& txn, TransactionEngineResult TransactionEngine::doDelete(const SerializedTransaction& txn,
std::vector<AffectedAccount>& accounts) std::vector<AffectedAccount>& accounts)
{ {
return terUNKNOWN; return tenUNKNOWN;
} }
// vim:ts=4 // vim:ts=4

View File

@@ -11,14 +11,18 @@
// It can also, verify signatures, verify fees, and give rejection reasons // It can also, verify signatures, verify fees, and give rejection reasons
enum TransactionEngineResult enum TransactionEngineResult
{ // <0 = Can never succeed, 0 = success, >0 = failed, but could succeed {
terGEN_IN_USE = -6, // Generator already in use. // tenCAN_NEVER_SUCCEED = <0
terCLAIMED = -5, // Can not claim a previously claimed account. tenGEN_IN_USE = -100, // Generator already in use.
terFAILED = -4, // Something broke horribly tenCLAIMED, // Can not claim a previously claimed account.
terUNKNOWN = -3, // The transactions requires logic not implemented yet tenFAILED, // Something broke horribly
terINSUF_FEE_P = -2, // fee totally insufficient tenUNKNOWN, // The transactions requires logic not implemented yet
terINVALID = -1, // The transaction is ill-formed tenINSUF_FEE_P, // fee totally insufficient
tenINVALID, // The transaction is ill-formed
terSUCCESS = 0, // The transaction was applied terSUCCESS = 0, // The transaction was applied
// terFAILED_BUT_COULD_SUCEED = >0
terALREADY, // The transaction was already in the ledger terALREADY, // The transaction was already in the ledger
terNO_ACCOUNT, // The source account does not exist terNO_ACCOUNT, // The source account does not exist
terNO_TARGET, // The destination does not exist terNO_TARGET, // The destination does not exist