Change/Fee transactor.

This commit is contained in:
JoelKatz
2013-04-15 22:59:16 -07:00
parent 8ed0d107fd
commit efb3c24518
8 changed files with 30 additions and 10 deletions

View File

@@ -16,16 +16,18 @@ enum TransactionEngineParams
{
tapNONE = 0x00,
tapNO_CHECK_SIGN = 0x01, // Signature already checked
tapNO_CHECK_SIGN = 0x01, // Signature already checked
tapOPEN_LEDGER = 0x10, // Transaction is running against an open ledger
tapOPEN_LEDGER = 0x10, // Transaction is running against an open ledger
// true = failures are not forwarded, check transaction fee
// false = debit ledger for consumed funds
tapRETRY = 0x20, // This is not the transaction's last pass
tapRETRY = 0x20, // This is not the transaction's last pass
// Transaction can be retried, soft failures allowed
tapADMIN = 0x40, // Transaction came from a privileged source
tapAFTER_END = 0x40, // We are processing the transaction last
tapADMIN = 0x400, // Transaction came from a privileged source
};
enum LedgerEntryAction

View File

@@ -315,6 +315,17 @@ bool STVector256::isEquivalent(const SerializedType& t) const
return v && (mValue == v->mValue);
}
bool STVector256::hasValue(const uint256& v) const
{
BOOST_FOREACH(const uint256& hash, mValue)
{
if (hash == v)
return true;
}
return false;
}
//
// STAccount
//

View File

@@ -869,7 +869,7 @@ public:
void setValue(const STVector256& v) { mValue = v.mValue; }
void setValue(const std::vector<uint256>& v) { mValue = v; }
void addValue(const uint256& v) { mValue.push_back(v); }
bool hasValue(const uint256& v) const;
Json::Value getJson(int) const;
};

View File

@@ -83,6 +83,7 @@ bool transResultInfo(TER terCode, std::string& strToken, std::string& strHuman)
{ terRETRY, "terRETRY", "Retry transaction." },
{ terFUNDS_SPENT, "terFUNDS_SPENT", "Can't set password, password set funds already spent." },
{ terINSUF_FEE_B, "terINSUF_FEE_B", "Account balance can't pay fee." },
{ terLAST, "terLAST", "Process last." },
{ terNO_ACCOUNT, "terNO_ACCOUNT", "The source account does not exist." },
{ terNO_AUTH, "terNO_AUTH", "Not authorized to hold IOUs." },
{ terNO_LINE, "terNO_LINE", "No such line." },

View File

@@ -101,6 +101,7 @@ enum TER // aka TransactionEngineResult
terNO_LINE, // Internal flag.
terOWNERS, // Can't succeed with non-zero owner count.
terPRE_SEQ, // Can't pay fee, no point in forwarding, therefore don't burden network.
terLAST, // Process after all other transactions
// 0: S Success (success)
// Causes:

View File

@@ -78,12 +78,11 @@ void TFInit()
;
DECLARE_TF(SetFee, ttFEE)
<< SOElement(sfFeatures, SOE_REQUIRED)
<< SOElement(sfBaseFee, SOE_REQUIRED)
<< SOElement(sfReferenceFeeUnits, SOE_REQUIRED)
<< SOElement(sfReserveBase, SOE_REQUIRED)
<< SOElement(sfReserveIncrement, SOE_REQUIRED)
;
;
}
TransactionFormat* TransactionFormat::getTxnFormat(TransactionType t)

View File

@@ -8,6 +8,7 @@
#include "OfferCancelTransactor.h"
#include "OfferCreateTransactor.h"
#include "TrustSetTransactor.h"
#include "ChangeTransactor.h"
SETUP_LOG();
@@ -29,6 +30,11 @@ UPTR_T<Transactor> Transactor::makeTransactor(const SerializedTransaction& txn,T
return UPTR_T<Transactor>(new OfferCancelTransactor(txn, params, engine));
case ttWALLET_ADD:
return UPTR_T<Transactor>(new WalletAddTransactor(txn, params, engine));
case ttFEATURE:
case ttFEE:
return UPTR_T<Transactor>(new ChangeTransactor(txn, params, engine));
default:
return UPTR_T<Transactor>();
}

View File

@@ -22,9 +22,9 @@ protected:
bool mHasAuthKey;
RippleAddress mSigningPubKey;
TER preCheck();
TER checkSeq();
TER payFee();
virtual TER preCheck();
virtual TER checkSeq();
virtual TER payFee();
void calculateFee();