Fix extraneous offer creation.

This commit is contained in:
Arthur Britto
2012-12-15 16:48:46 -08:00
parent 65bb4a8941
commit 0bc4a7b1e2
5 changed files with 15 additions and 3 deletions

View File

@@ -7,6 +7,7 @@
#include "Log.h"
SETUP_LOG();
DECLARE_INSTANCE(LedgerEntrySetEntry);
DECLARE_INSTANCE(LedgerEntrySet)
@@ -1284,4 +1285,5 @@ void LedgerEntrySet::accountSend(const uint160& uSenderID, const uint160& uRecei
rippleSend(uSenderID, uReceiverID, saAmount);
}
}
// vim:ts=4

View File

@@ -3,6 +3,8 @@
#include <boost/foreach.hpp>
#include <boost/bind.hpp>
SETUP_LOG();
// Take as much as possible. Adjusts account balances. Charges fees on top to taker.
// --> uBookBase: The order book to take against.
// --> saTakerPays: What the taker offers (w/ issuer)
@@ -262,7 +264,6 @@ TER OfferCreateTransactor::doApply()
const uint32 uSequence = mTxn.getSequence();
const uint256 uLedgerIndex = Ledger::getOfferIndex(mTxnAccountID, uSequence);
SLE::pointer sleOffer = mEngine->entryCreate(ltOFFER, uLedgerIndex);
Log(lsINFO) << "doOfferCreate: Creating offer node: " << uLedgerIndex.ToString() << " uSequence=" << uSequence;
@@ -431,6 +432,8 @@ TER OfferCreateTransactor::doApply()
Log(lsWARNING) << "doOfferCreate: uPaysCurrency=" << saTakerPays.getHumanCurrency();
Log(lsWARNING) << "doOfferCreate: uGetsCurrency=" << saTakerGets.getHumanCurrency();
SLE::pointer sleOffer = mEngine->entryCreate(ltOFFER, uLedgerIndex);
sleOffer->setFieldAccount(sfAccount, mTxnAccountID);
sleOffer->setFieldU32(sfSequence, uSequence);
sleOffer->setFieldH256(sfBookDirectory, uDirectory);
@@ -444,11 +447,16 @@ TER OfferCreateTransactor::doApply()
if (bPassive)
sleOffer->setFlag(lsfPassive);
Log(lsINFO) << boost::str(boost::format("doOfferCreate: final terResult=%s sleOffer=%s")
% transToken(terResult)
% sleOffer->getJson(0));
}
}
Log(lsINFO) << "doOfferCreate: final sleOffer=" << sleOffer->getJson(0);
tLog(tesSUCCESS != terResult, lsINFO) << boost::str(boost::format("doOfferCreate: final terResult=%s") % transToken(terResult));
return terResult;
}
// vim:ts=4

View File

@@ -17,6 +17,7 @@
#include "utils.h"
SETUP_LOG();
DECLARE_INSTANCE(TransactionEngine);
void TransactionEngine::txnWrite()

View File

@@ -91,4 +91,5 @@ std::string transHuman(TER terCode)
return transResultInfo(terCode, strToken, strHuman) ? strHuman : "-";
}
// vim:ts=4

View File

@@ -451,7 +451,7 @@ buster.testCase("Offer tests", {
});
},
"//=>ripple currency conversion : offerer into debt" :
"ripple currency conversion : offerer into debt" :
// alice in, carol out
function (done) {
var self = this;