Return temINVALID_FLAG for transaction with no flags.

This commit is contained in:
Arthur Britto
2013-01-03 14:07:41 -08:00
parent 7c0b43fe06
commit 7dfbe2aea1
7 changed files with 123 additions and 73 deletions

View File

@@ -4,7 +4,16 @@ SETUP_LOG();
TER AccountSetTransactor::doApply() TER AccountSetTransactor::doApply()
{ {
cLog(lsINFO) << "doAccountSet>"; cLog(lsINFO) << "AccountSet>";
const uint32 uTxFlags = mTxn.getFlags();
if (uTxFlags)
{
cLog(lsINFO) << "AccountSet: Malformed transaction: Invalid flags set.";
return temINVALID_FLAG;
}
// //
// EmailHash // EmailHash
@@ -16,13 +25,13 @@ TER AccountSetTransactor::doApply()
if (!uHash) if (!uHash)
{ {
cLog(lsINFO) << "doAccountSet: unset email hash"; cLog(lsINFO) << "AccountSet: unset email hash";
mTxnAccount->makeFieldAbsent(sfEmailHash); mTxnAccount->makeFieldAbsent(sfEmailHash);
} }
else else
{ {
cLog(lsINFO) << "doAccountSet: set email hash"; cLog(lsINFO) << "AccountSet: set email hash";
mTxnAccount->setFieldH128(sfEmailHash, uHash); mTxnAccount->setFieldH128(sfEmailHash, uHash);
} }
@@ -38,13 +47,13 @@ TER AccountSetTransactor::doApply()
if (!uHash) if (!uHash)
{ {
cLog(lsINFO) << "doAccountSet: unset wallet locator"; cLog(lsINFO) << "AccountSet: unset wallet locator";
mTxnAccount->makeFieldAbsent(sfEmailHash); mTxnAccount->makeFieldAbsent(sfEmailHash);
} }
else else
{ {
cLog(lsINFO) << "doAccountSet: set wallet locator"; cLog(lsINFO) << "AccountSet: set wallet locator";
mTxnAccount->setFieldH256(sfWalletLocator, uHash); mTxnAccount->setFieldH256(sfWalletLocator, uHash);
} }
@@ -60,7 +69,7 @@ TER AccountSetTransactor::doApply()
} }
else else
{ {
cLog(lsINFO) << "doAccountSet: set message key"; cLog(lsINFO) << "AccountSet: set message key";
mTxnAccount->setFieldVL(sfMessageKey, mTxn.getFieldVL(sfMessageKey)); mTxnAccount->setFieldVL(sfMessageKey, mTxn.getFieldVL(sfMessageKey));
} }
@@ -75,13 +84,13 @@ TER AccountSetTransactor::doApply()
if (vucDomain.empty()) if (vucDomain.empty())
{ {
cLog(lsINFO) << "doAccountSet: unset domain"; cLog(lsINFO) << "AccountSet: unset domain";
mTxnAccount->makeFieldAbsent(sfDomain); mTxnAccount->makeFieldAbsent(sfDomain);
} }
else else
{ {
cLog(lsINFO) << "doAccountSet: set domain"; cLog(lsINFO) << "AccountSet: set domain";
mTxnAccount->setFieldVL(sfDomain, vucDomain); mTxnAccount->setFieldVL(sfDomain, vucDomain);
} }
@@ -97,25 +106,27 @@ TER AccountSetTransactor::doApply()
if (!uRate || uRate == QUALITY_ONE) if (!uRate || uRate == QUALITY_ONE)
{ {
cLog(lsINFO) << "doAccountSet: unset transfer rate"; cLog(lsINFO) << "AccountSet: unset transfer rate";
mTxnAccount->makeFieldAbsent(sfTransferRate); mTxnAccount->makeFieldAbsent(sfTransferRate);
} }
else if (uRate > QUALITY_ONE) else if (uRate > QUALITY_ONE)
{ {
cLog(lsINFO) << "doAccountSet: set transfer rate"; cLog(lsINFO) << "AccountSet: set transfer rate";
mTxnAccount->setFieldU32(sfTransferRate, uRate); mTxnAccount->setFieldU32(sfTransferRate, uRate);
} }
else else
{ {
cLog(lsINFO) << "doAccountSet: bad transfer rate"; cLog(lsINFO) << "AccountSet: bad transfer rate";
return temBAD_TRANSFER_RATE; return temBAD_TRANSFER_RATE;
} }
} }
cLog(lsINFO) << "doAccountSet<"; cLog(lsINFO) << "AccountSet<";
return tesSUCCESS; return tesSUCCESS;
} }
// vim:ts=4

View File

@@ -1,17 +1,28 @@
#include "OfferCancelTransactor.h" #include "OfferCancelTransactor.h"
#include "Log.h" #include "Log.h"
SETUP_LOG();
TER OfferCancelTransactor::doApply() TER OfferCancelTransactor::doApply()
{ {
TER terResult; TER terResult;
const uint32 uOfferSequence = mTxn.getFieldU32(sfOfferSequence); const uint32 uOfferSequence = mTxn.getFieldU32(sfOfferSequence);
const uint32 uAccountSequenceNext = mTxnAccount->getFieldU32(sfSequence); const uint32 uAccountSequenceNext = mTxnAccount->getFieldU32(sfSequence);
Log(lsDEBUG) << "doOfferCancel: uAccountSequenceNext=" << uAccountSequenceNext << " uOfferSequence=" << uOfferSequence; cLog(lsDEBUG) << "OfferCancel: uAccountSequenceNext=" << uAccountSequenceNext << " uOfferSequence=" << uOfferSequence;
const uint32 uTxFlags = mTxn.getFlags();
if (uTxFlags)
{
cLog(lsINFO) << "OfferCancel: Malformed transaction: Invalid flags set.";
return temINVALID_FLAG;
}
if (!uOfferSequence || uAccountSequenceNext-1 <= uOfferSequence) if (!uOfferSequence || uAccountSequenceNext-1 <= uOfferSequence)
{ {
Log(lsINFO) << "doOfferCancel: uAccountSequenceNext=" << uAccountSequenceNext << " uOfferSequence=" << uOfferSequence; cLog(lsINFO) << "OfferCancel: uAccountSequenceNext=" << uAccountSequenceNext << " uOfferSequence=" << uOfferSequence;
terResult = temBAD_SEQUENCE; terResult = temBAD_SEQUENCE;
} }
@@ -22,13 +33,13 @@ TER OfferCancelTransactor::doApply()
if (sleOffer) if (sleOffer)
{ {
Log(lsWARNING) << "doOfferCancel: uOfferSequence=" << uOfferSequence; cLog(lsWARNING) << "OfferCancel: uOfferSequence=" << uOfferSequence;
terResult = mEngine->getNodes().offerDelete(sleOffer, uOfferIndex, mTxnAccountID); terResult = mEngine->getNodes().offerDelete(sleOffer, uOfferIndex, mTxnAccountID);
} }
else else
{ {
Log(lsWARNING) << "doOfferCancel: offer not found: " cLog(lsWARNING) << "OfferCancel: offer not found: "
<< RippleAddress::createHumanAccountID(mTxnAccountID) << RippleAddress::createHumanAccountID(mTxnAccountID)
<< " : " << uOfferSequence << " : " << uOfferSequence
<< " : " << uOfferIndex.ToString(); << " : " << uOfferIndex.ToString();

View File

@@ -256,13 +256,13 @@ TER OfferCreateTransactor::takeOffers(
TER OfferCreateTransactor::doApply() TER OfferCreateTransactor::doApply()
{ {
cLog(lsWARNING) << "doOfferCreate> " << mTxn.getJson(0); cLog(lsWARNING) << "OfferCreate> " << mTxn.getJson(0);
const uint32 uTxFlags = mTxn.getFlags(); const uint32 uTxFlags = mTxn.getFlags();
const bool bPassive = isSetBit(uTxFlags, tfPassive); const bool bPassive = isSetBit(uTxFlags, tfPassive);
STAmount saTakerPays = mTxn.getFieldAmount(sfTakerPays); STAmount saTakerPays = mTxn.getFieldAmount(sfTakerPays);
STAmount saTakerGets = mTxn.getFieldAmount(sfTakerGets); STAmount saTakerGets = mTxn.getFieldAmount(sfTakerGets);
cLog(lsINFO) << boost::str(boost::format("doOfferCreate: saTakerPays=%s saTakerGets=%s") cLog(lsINFO) << boost::str(boost::format("OfferCreate: saTakerPays=%s saTakerGets=%s")
% saTakerPays.getFullText() % saTakerPays.getFullText()
% saTakerGets.getFullText()); % saTakerGets.getFullText());
@@ -274,7 +274,7 @@ TER OfferCreateTransactor::doApply()
const uint256 uLedgerIndex = Ledger::getOfferIndex(mTxnAccountID, uSequence); const uint256 uLedgerIndex = Ledger::getOfferIndex(mTxnAccountID, uSequence);
cLog(lsINFO) << "doOfferCreate: Creating offer node: " << uLedgerIndex.ToString() << " uSequence=" << uSequence; cLog(lsINFO) << "OfferCreate: Creating offer node: " << uLedgerIndex.ToString() << " uSequence=" << uSequence;
const uint160 uPaysCurrency = saTakerPays.getCurrency(); const uint160 uPaysCurrency = saTakerPays.getCurrency();
const uint160 uGetsCurrency = saTakerGets.getCurrency(); const uint160 uGetsCurrency = saTakerGets.getCurrency();
@@ -287,49 +287,49 @@ TER OfferCreateTransactor::doApply()
if (uTxFlags & tfOfferCreateMask) if (uTxFlags & tfOfferCreateMask)
{ {
cLog(lsINFO) << "doOfferCreate: Malformed transaction: Invalid flags set."; cLog(lsINFO) << "OfferCreate: Malformed transaction: Invalid flags set.";
return temINVALID_FLAG; return temINVALID_FLAG;
} }
else if (bHaveExpiration && !uExpiration) else if (bHaveExpiration && !uExpiration)
{ {
cLog(lsWARNING) << "doOfferCreate: Malformed offer: bad expiration"; cLog(lsWARNING) << "OfferCreate: Malformed offer: bad expiration";
terResult = temBAD_EXPIRATION; terResult = temBAD_EXPIRATION;
} }
else if (bHaveExpiration && mEngine->getLedger()->getParentCloseTimeNC() >= uExpiration) else if (bHaveExpiration && mEngine->getLedger()->getParentCloseTimeNC() >= uExpiration)
{ {
cLog(lsWARNING) << "doOfferCreate: Expired transaction: offer expired"; cLog(lsWARNING) << "OfferCreate: Expired transaction: offer expired";
terResult = tesSUCCESS; // Only charged fee. terResult = tesSUCCESS; // Only charged fee.
} }
else if (saTakerPays.isNative() && saTakerGets.isNative()) else if (saTakerPays.isNative() && saTakerGets.isNative())
{ {
cLog(lsWARNING) << "doOfferCreate: Malformed offer: XRP for XRP"; cLog(lsWARNING) << "OfferCreate: Malformed offer: XRP for XRP";
terResult = temBAD_OFFER; terResult = temBAD_OFFER;
} }
else if (!saTakerPays.isPositive() || !saTakerGets.isPositive()) else if (!saTakerPays.isPositive() || !saTakerGets.isPositive())
{ {
cLog(lsWARNING) << "doOfferCreate: Malformed offer: bad amount"; cLog(lsWARNING) << "OfferCreate: Malformed offer: bad amount";
terResult = temBAD_OFFER; terResult = temBAD_OFFER;
} }
else if (uPaysCurrency == uGetsCurrency && uPaysIssuerID == uGetsIssuerID) else if (uPaysCurrency == uGetsCurrency && uPaysIssuerID == uGetsIssuerID)
{ {
cLog(lsWARNING) << "doOfferCreate: Malformed offer: redundant offer"; cLog(lsWARNING) << "OfferCreate: Malformed offer: redundant offer";
terResult = temREDUNDANT; terResult = temREDUNDANT;
} }
else if (saTakerPays.isNative() != !uPaysIssuerID || saTakerGets.isNative() != !uGetsIssuerID) else if (saTakerPays.isNative() != !uPaysIssuerID || saTakerGets.isNative() != !uGetsIssuerID)
{ {
cLog(lsWARNING) << "doOfferCreate: Malformed offer: bad issuer"; cLog(lsWARNING) << "OfferCreate: Malformed offer: bad issuer";
terResult = temBAD_ISSUER; terResult = temBAD_ISSUER;
} }
else if (!mEngine->getNodes().accountFunds(mTxnAccountID, saTakerGets).isPositive()) else if (!mEngine->getNodes().accountFunds(mTxnAccountID, saTakerGets).isPositive())
{ {
cLog(lsWARNING) << "doOfferCreate: delay: Offers must be at least partially funded."; cLog(lsWARNING) << "OfferCreate: delay: Offers must be at least partially funded.";
terResult = tecUNFUNDED; terResult = tecUNFUNDED;
} }
@@ -340,7 +340,7 @@ TER OfferCreateTransactor::doApply()
if (!sleTakerPays) if (!sleTakerPays)
{ {
cLog(lsWARNING) << "doOfferCreate: delay: can't receive IOUs from non-existent issuer: " << RippleAddress::createHumanAccountID(uPaysIssuerID); cLog(lsWARNING) << "OfferCreate: delay: can't receive IOUs from non-existent issuer: " << RippleAddress::createHumanAccountID(uPaysIssuerID);
terResult = terNO_ACCOUNT; terResult = terNO_ACCOUNT;
} }
@@ -353,13 +353,13 @@ TER OfferCreateTransactor::doApply()
{ {
const uint256 uTakeBookBase = Ledger::getBookBase(uGetsCurrency, uGetsIssuerID, uPaysCurrency, uPaysIssuerID); const uint256 uTakeBookBase = Ledger::getBookBase(uGetsCurrency, uGetsIssuerID, uPaysCurrency, uPaysIssuerID);
cLog(lsINFO) << boost::str(boost::format("doOfferCreate: take against book: %s for %s -> %s") cLog(lsINFO) << boost::str(boost::format("OfferCreate: take against book: %s for %s -> %s")
% uTakeBookBase.ToString() % uTakeBookBase.ToString()
% saTakerGets.getFullText() % saTakerGets.getFullText()
% saTakerPays.getFullText()); % saTakerPays.getFullText());
// Take using the parameters of the offer. // Take using the parameters of the offer.
cLog(lsWARNING) << "doOfferCreate: takeOffers: BEFORE saTakerGets=" << saTakerGets.getFullText(); cLog(lsWARNING) << "OfferCreate: takeOffers: BEFORE saTakerGets=" << saTakerGets.getFullText();
terResult = takeOffers( terResult = takeOffers(
bPassive, bPassive,
uTakeBookBase, uTakeBookBase,
@@ -371,11 +371,11 @@ TER OfferCreateTransactor::doApply()
saOfferGot // How much was got. saOfferGot // How much was got.
); );
cLog(lsWARNING) << "doOfferCreate: takeOffers=" << terResult; cLog(lsWARNING) << "OfferCreate: takeOffers=" << terResult;
cLog(lsWARNING) << "doOfferCreate: takeOffers: saOfferPaid=" << saOfferPaid.getFullText(); cLog(lsWARNING) << "OfferCreate: takeOffers: saOfferPaid=" << saOfferPaid.getFullText();
cLog(lsWARNING) << "doOfferCreate: takeOffers: saOfferGot=" << saOfferGot.getFullText(); cLog(lsWARNING) << "OfferCreate: takeOffers: saOfferGot=" << saOfferGot.getFullText();
cLog(lsWARNING) << "doOfferCreate: takeOffers: saTakerPays=" << saTakerPays.getFullText(); cLog(lsWARNING) << "OfferCreate: takeOffers: saTakerPays=" << saTakerPays.getFullText();
cLog(lsWARNING) << "doOfferCreate: takeOffers: AFTER saTakerGets=" << saTakerGets.getFullText(); cLog(lsWARNING) << "OfferCreate: takeOffers: AFTER saTakerGets=" << saTakerGets.getFullText();
if (tesSUCCESS == terResult) if (tesSUCCESS == terResult)
{ {
@@ -384,13 +384,13 @@ TER OfferCreateTransactor::doApply()
} }
} }
cLog(lsWARNING) << "doOfferCreate: takeOffers: saTakerPays=" << saTakerPays.getFullText(); cLog(lsWARNING) << "OfferCreate: takeOffers: saTakerPays=" << saTakerPays.getFullText();
cLog(lsWARNING) << "doOfferCreate: takeOffers: saTakerGets=" << saTakerGets.getFullText(); cLog(lsWARNING) << "OfferCreate: takeOffers: saTakerGets=" << saTakerGets.getFullText();
cLog(lsWARNING) << "doOfferCreate: takeOffers: mTxnAccountID=" << RippleAddress::createHumanAccountID(mTxnAccountID); cLog(lsWARNING) << "OfferCreate: takeOffers: mTxnAccountID=" << RippleAddress::createHumanAccountID(mTxnAccountID);
cLog(lsWARNING) << "doOfferCreate: takeOffers: FUNDS=" << mEngine->getNodes().accountFunds(mTxnAccountID, saTakerGets).getFullText(); cLog(lsWARNING) << "OfferCreate: takeOffers: FUNDS=" << mEngine->getNodes().accountFunds(mTxnAccountID, saTakerGets).getFullText();
// cLog(lsWARNING) << "doOfferCreate: takeOffers: uPaysIssuerID=" << RippleAddress::createHumanAccountID(uPaysIssuerID); // cLog(lsWARNING) << "OfferCreate: takeOffers: uPaysIssuerID=" << RippleAddress::createHumanAccountID(uPaysIssuerID);
// cLog(lsWARNING) << "doOfferCreate: takeOffers: uGetsIssuerID=" << RippleAddress::createHumanAccountID(uGetsIssuerID); // cLog(lsWARNING) << "OfferCreate: takeOffers: uGetsIssuerID=" << RippleAddress::createHumanAccountID(uGetsIssuerID);
if (tesSUCCESS != terResult if (tesSUCCESS != terResult
|| !saTakerPays // Wants nothing more. || !saTakerPays // Wants nothing more.
@@ -424,7 +424,7 @@ TER OfferCreateTransactor::doApply()
else else
{ {
// We need to place the remainder of the offer into its order book. // We need to place the remainder of the offer into its order book.
cLog(lsINFO) << boost::str(boost::format("doOfferCreate: offer not fully consumed: saTakerPays=%s saTakerGets=%s") cLog(lsINFO) << boost::str(boost::format("OfferCreate: offer not fully consumed: saTakerPays=%s saTakerGets=%s")
% saTakerPays.getFullText() % saTakerPays.getFullText()
% saTakerGets.getFullText()); % saTakerGets.getFullText());
@@ -440,7 +440,7 @@ TER OfferCreateTransactor::doApply()
uint256 uBookBase = Ledger::getBookBase(uPaysCurrency, uPaysIssuerID, uGetsCurrency, uGetsIssuerID); uint256 uBookBase = Ledger::getBookBase(uPaysCurrency, uPaysIssuerID, uGetsCurrency, uGetsIssuerID);
cLog(lsINFO) << boost::str(boost::format("doOfferCreate: adding to book: %s : %s/%s -> %s/%s") cLog(lsINFO) << boost::str(boost::format("OfferCreate: adding to book: %s : %s/%s -> %s/%s")
% uBookBase.ToString() % uBookBase.ToString()
% saTakerPays.getHumanCurrency() % saTakerPays.getHumanCurrency()
% RippleAddress::createHumanAccountID(saTakerPays.getIssuer()) % RippleAddress::createHumanAccountID(saTakerPays.getIssuer())
@@ -457,13 +457,13 @@ TER OfferCreateTransactor::doApply()
if (tesSUCCESS == terResult) if (tesSUCCESS == terResult)
{ {
cLog(lsWARNING) << "doOfferCreate: sfAccount=" << RippleAddress::createHumanAccountID(mTxnAccountID); cLog(lsWARNING) << "OfferCreate: sfAccount=" << RippleAddress::createHumanAccountID(mTxnAccountID);
cLog(lsWARNING) << "doOfferCreate: uPaysIssuerID=" << RippleAddress::createHumanAccountID(uPaysIssuerID); cLog(lsWARNING) << "OfferCreate: uPaysIssuerID=" << RippleAddress::createHumanAccountID(uPaysIssuerID);
cLog(lsWARNING) << "doOfferCreate: uGetsIssuerID=" << RippleAddress::createHumanAccountID(uGetsIssuerID); cLog(lsWARNING) << "OfferCreate: uGetsIssuerID=" << RippleAddress::createHumanAccountID(uGetsIssuerID);
cLog(lsWARNING) << "doOfferCreate: saTakerPays.isNative()=" << saTakerPays.isNative(); cLog(lsWARNING) << "OfferCreate: saTakerPays.isNative()=" << saTakerPays.isNative();
cLog(lsWARNING) << "doOfferCreate: saTakerGets.isNative()=" << saTakerGets.isNative(); cLog(lsWARNING) << "OfferCreate: saTakerGets.isNative()=" << saTakerGets.isNative();
cLog(lsWARNING) << "doOfferCreate: uPaysCurrency=" << saTakerPays.getHumanCurrency(); cLog(lsWARNING) << "OfferCreate: uPaysCurrency=" << saTakerPays.getHumanCurrency();
cLog(lsWARNING) << "doOfferCreate: uGetsCurrency=" << saTakerGets.getHumanCurrency(); cLog(lsWARNING) << "OfferCreate: uGetsCurrency=" << saTakerGets.getHumanCurrency();
SLE::pointer sleOffer = mEngine->entryCreate(ltOFFER, uLedgerIndex); SLE::pointer sleOffer = mEngine->entryCreate(ltOFFER, uLedgerIndex);
@@ -481,13 +481,13 @@ TER OfferCreateTransactor::doApply()
if (bPassive) if (bPassive)
sleOffer->setFlag(lsfPassive); sleOffer->setFlag(lsfPassive);
cLog(lsINFO) << boost::str(boost::format("doOfferCreate: final terResult=%s sleOffer=%s") cLog(lsINFO) << boost::str(boost::format("OfferCreate: final terResult=%s sleOffer=%s")
% transToken(terResult) % transToken(terResult)
% sleOffer->getJson(0)); % sleOffer->getJson(0));
} }
} }
tLog(tesSUCCESS != terResult, lsINFO) << boost::str(boost::format("doOfferCreate: final terResult=%s") % transToken(terResult)); tLog(tesSUCCESS != terResult, lsINFO) << boost::str(boost::format("OfferCreate: final terResult=%s") % transToken(terResult));
return terResult; return terResult;
} }

View File

@@ -26,37 +26,37 @@ TER PaymentTransactor::doApply()
const uint160 uSrcCurrency = saMaxAmount.getCurrency(); const uint160 uSrcCurrency = saMaxAmount.getCurrency();
const uint160 uDstCurrency = saDstAmount.getCurrency(); const uint160 uDstCurrency = saDstAmount.getCurrency();
cLog(lsINFO) << boost::str(boost::format("doPayment> saMaxAmount=%s saDstAmount=%s") cLog(lsINFO) << boost::str(boost::format("Payment> saMaxAmount=%s saDstAmount=%s")
% saMaxAmount.getFullText() % saMaxAmount.getFullText()
% saDstAmount.getFullText()); % saDstAmount.getFullText());
if (uTxFlags & tfPaymentMask) if (uTxFlags & tfPaymentMask)
{ {
cLog(lsINFO) << "doPayment: Malformed transaction: Invalid flags set."; cLog(lsINFO) << "Payment: Malformed transaction: Invalid flags set.";
return temINVALID_FLAG; return temINVALID_FLAG;
} }
else if (!uDstAccountID) else if (!uDstAccountID)
{ {
cLog(lsINFO) << "doPayment: Malformed transaction: Payment destination account not specified."; cLog(lsINFO) << "Payment: Malformed transaction: Payment destination account not specified.";
return temDST_NEEDED; return temDST_NEEDED;
} }
else if (bMax && !saMaxAmount.isPositive()) else if (bMax && !saMaxAmount.isPositive())
{ {
cLog(lsINFO) << "doPayment: Malformed transaction: bad max amount: " << saMaxAmount.getFullText(); cLog(lsINFO) << "Payment: Malformed transaction: bad max amount: " << saMaxAmount.getFullText();
return temBAD_AMOUNT; return temBAD_AMOUNT;
} }
else if (!saDstAmount.isPositive()) else if (!saDstAmount.isPositive())
{ {
cLog(lsINFO) << "doPayment: Malformed transaction: bad dst amount: " << saDstAmount.getFullText(); cLog(lsINFO) << "Payment: Malformed transaction: bad dst amount: " << saDstAmount.getFullText();
return temBAD_AMOUNT; return temBAD_AMOUNT;
} }
else if (mTxnAccountID == uDstAccountID && uSrcCurrency == uDstCurrency && !bPaths) else if (mTxnAccountID == uDstAccountID && uSrcCurrency == uDstCurrency && !bPaths)
{ {
cLog(lsINFO) << boost::str(boost::format("doPayment: Malformed transaction: Redundant transaction: src=%s, dst=%s, src_cur=%s, dst_cur=%s") cLog(lsINFO) << boost::str(boost::format("Payment: Malformed transaction: Redundant transaction: src=%s, dst=%s, src_cur=%s, dst_cur=%s")
% mTxnAccountID.ToString() % mTxnAccountID.ToString()
% uDstAccountID.ToString() % uDstAccountID.ToString()
% uSrcCurrency.ToString() % uSrcCurrency.ToString()
@@ -68,7 +68,7 @@ TER PaymentTransactor::doApply()
&& ((saMaxAmount == saDstAmount && saMaxAmount.getCurrency() == saDstAmount.getCurrency()) && ((saMaxAmount == saDstAmount && saMaxAmount.getCurrency() == saDstAmount.getCurrency())
|| (saDstAmount.isNative() && saMaxAmount.isNative()))) || (saDstAmount.isNative() && saMaxAmount.isNative())))
{ {
cLog(lsINFO) << "doPayment: Malformed transaction: bad SendMax."; cLog(lsINFO) << "Payment: Malformed transaction: bad SendMax.";
return temINVALID; return temINVALID;
} }
@@ -80,14 +80,14 @@ TER PaymentTransactor::doApply()
if (!saDstAmount.isNative()) if (!saDstAmount.isNative())
{ {
cLog(lsINFO) << "doPayment: Delay transaction: Destination account does not exist."; cLog(lsINFO) << "Payment: Delay transaction: Destination account does not exist.";
// Another transaction could create the account and then this transaction would succeed. // Another transaction could create the account and then this transaction would succeed.
return tecNO_DST; return tecNO_DST;
} }
else if (saDstAmount.getNValue() < mEngine->getLedger()->getReserve(0)) // Reserve is not scaled by load. else if (saDstAmount.getNValue() < mEngine->getLedger()->getReserve(0)) // Reserve is not scaled by load.
{ {
cLog(lsINFO) << "doPayment: Delay transaction: Destination account does not exist. Insufficent payment to create account."; cLog(lsINFO) << "Payment: Delay transaction: Destination account does not exist. Insufficent payment to create account.";
// Another transaction could create the account and then this transaction would succeed. // Another transaction could create the account and then this transaction would succeed.
return tecNO_DST_INSUF_XRP; return tecNO_DST_INSUF_XRP;
@@ -102,7 +102,7 @@ TER PaymentTransactor::doApply()
#if ENABLE_REQUIRE_DEST_TAG #if ENABLE_REQUIRE_DEST_TAG
else if ((sleDst->getFlags() & lsfRequireDestTag) && !mTxn.isFieldPresent(sfDestinationTag)) else if ((sleDst->getFlags() & lsfRequireDestTag) && !mTxn.isFieldPresent(sfDestinationTag))
{ {
cLog(lsINFO) << "doPayment: Malformed transaction: DestinationTag required."; cLog(lsINFO) << "Payment: Malformed transaction: DestinationTag required.";
return temINVALID; return temINVALID;
} }
@@ -156,7 +156,7 @@ TER PaymentTransactor::doApply()
{ {
// Vote no. However, transaction might succeed, if applied in a different order. // Vote no. However, transaction might succeed, if applied in a different order.
cLog(lsINFO) << ""; cLog(lsINFO) << "";
cLog(lsINFO) << boost::str(boost::format("doPayment: Delay transaction: Insufficient funds: %s / %s (%d)") cLog(lsINFO) << boost::str(boost::format("Payment: Delay transaction: Insufficient funds: %s / %s (%d)")
% saSrcXRPBalance.getText() % (saDstAmount + uReserve).getText() % uReserve); % saSrcXRPBalance.getText() % (saDstAmount + uReserve).getText() % uReserve);
terResult = tecUNFUNDED; terResult = tecUNFUNDED;
@@ -179,7 +179,7 @@ TER PaymentTransactor::doApply()
if (transResultInfo(terResult, strToken, strHuman)) if (transResultInfo(terResult, strToken, strHuman))
{ {
cLog(lsINFO) << boost::str(boost::format("doPayment: %s: %s") % strToken % strHuman); cLog(lsINFO) << boost::str(boost::format("Payment: %s: %s") % strToken % strHuman);
} }
else else
{ {

View File

@@ -1,14 +1,12 @@
#include "RegularKeySetTransactor.h" #include "RegularKeySetTransactor.h"
#include "Log.h" #include "Log.h"
SETUP_LOG(); SETUP_LOG();
uint64_t RegularKeySetTransactor::calculateBaseFee() uint64_t RegularKeySetTransactor::calculateBaseFee()
{ {
if ( !(mTxnAccount->getFlags() & lsfPasswordSpent) && if ( !(mTxnAccount->getFlags() & lsfPasswordSpent)
(mSigningPubKey.getAccountID() == mTxnAccountID)) && (mSigningPubKey.getAccountID() == mTxnAccountID))
{ // flag is armed and they signed with the right account { // flag is armed and they signed with the right account
return 0; return 0;
} }
@@ -18,9 +16,18 @@ uint64_t RegularKeySetTransactor::calculateBaseFee()
TER RegularKeySetTransactor::doApply() TER RegularKeySetTransactor::doApply()
{ {
std::cerr << "doRegularKeySet>" << std::endl; std::cerr << "RegularKeySet>" << std::endl;
if(mFeeDue.isZero()) const uint32 uTxFlags = mTxn.getFlags();
if (uTxFlags)
{
cLog(lsINFO) << "RegularKeySet: Malformed transaction: Invalid flags set.";
return temINVALID_FLAG;
}
if (mFeeDue.isZero())
{ {
mTxnAccount->setFlag(lsfPasswordSpent); mTxnAccount->setFlag(lsfPasswordSpent);
} }
@@ -28,8 +35,9 @@ TER RegularKeySetTransactor::doApply()
uint160 uAuthKeyID=mTxn.getFieldAccount160(sfRegularKey); uint160 uAuthKeyID=mTxn.getFieldAccount160(sfRegularKey);
mTxnAccount->setFieldAccount(sfRegularKey, uAuthKeyID); mTxnAccount->setFieldAccount(sfRegularKey, uAuthKeyID);
std::cerr << "RegularKeySet<" << std::endl;
std::cerr << "doRegularKeySet<" << std::endl;
return tesSUCCESS; return tesSUCCESS;
} }
// vim:ts=4

View File

@@ -25,6 +25,15 @@ TER TrustSetTransactor::doApply()
if (bQualityOut && QUALITY_ONE == uQualityOut) if (bQualityOut && QUALITY_ONE == uQualityOut)
uQualityOut = 0; uQualityOut = 0;
const uint32 uTxFlags = mTxn.getFlags();
if (uTxFlags)
{
cLog(lsINFO) << "doTrustSet: Malformed transaction: Invalid flags set.";
return temINVALID_FLAG;
}
// Check if destination makes sense. // Check if destination makes sense.
if (saLimitAmount.isNegative()) if (saLimitAmount.isNegative())

View File

@@ -1,5 +1,7 @@
#include "WalletAddTransactor.h" #include "WalletAddTransactor.h"
SETUP_LOG();
TER WalletAddTransactor::doApply() TER WalletAddTransactor::doApply()
{ {
std::cerr << "WalletAdd>" << std::endl; std::cerr << "WalletAdd>" << std::endl;
@@ -7,9 +9,18 @@ TER WalletAddTransactor::doApply()
const std::vector<unsigned char> vucPubKey = mTxn.getFieldVL(sfPublicKey); const std::vector<unsigned char> vucPubKey = mTxn.getFieldVL(sfPublicKey);
const std::vector<unsigned char> vucSignature = mTxn.getFieldVL(sfSignature); const std::vector<unsigned char> vucSignature = mTxn.getFieldVL(sfSignature);
const uint160 uAuthKeyID = mTxn.getFieldAccount160(sfRegularKey); const uint160 uAuthKeyID = mTxn.getFieldAccount160(sfRegularKey);
const RippleAddress naMasterPubKey = RippleAddress::createAccountPublic(vucPubKey); const RippleAddress naMasterPubKey = RippleAddress::createAccountPublic(vucPubKey);
const uint160 uDstAccountID = naMasterPubKey.getAccountID(); const uint160 uDstAccountID = naMasterPubKey.getAccountID();
const uint32 uTxFlags = mTxn.getFlags();
if (uTxFlags)
{
cLog(lsINFO) << "WalletAdd: Malformed transaction: Invalid flags set.";
return temINVALID_FLAG;
}
// FIXME: This should be moved to the transaction's signature check logic and cached // FIXME: This should be moved to the transaction's signature check logic and cached
if (!naMasterPubKey.accountPublicVerify(Serializer::getSHA512Half(uAuthKeyID.begin(), uAuthKeyID.size()), vucSignature)) if (!naMasterPubKey.accountPublicVerify(Serializer::getSHA512Half(uAuthKeyID.begin(), uAuthKeyID.size()), vucSignature))
{ {