Avoid construcing a RippleAddress just to throw it away.

This commit is contained in:
JoelKatz
2013-05-13 18:28:54 -07:00
parent c9fd800ea4
commit bcf0fc0b3a
6 changed files with 12 additions and 10 deletions

View File

@@ -985,7 +985,7 @@ TER LedgerEntrySet::offerDelete(SLE::ref sleOffer, const uint256& uOfferIndex, c
TER LedgerEntrySet::offerDelete(const uint256& uOfferIndex)
{
SLE::pointer sleOffer = entryCache(ltOFFER, uOfferIndex);
const uint160 uOwnerID = sleOffer->getFieldAccount(sfAccount).getAccountID();
const uint160 uOwnerID = sleOffer->getFieldAccount160(sfAccount);
return offerDelete(sleOffer, uOfferIndex, uOwnerID);
}

View File

@@ -1864,11 +1864,13 @@ void NetworkOPs::getBookPage(Ledger::pointer lpLedger, const uint160& uTakerPays
unsigned int uBookEntry;
STAmount saDirRate;
// unsigned int iLeft = iLimit;
unsigned int iLeft = iLimit;
if ((iLeft == 0) || (iLeft > 300))
iLeft = 300;
uint32 uTransferRate = lesActive.rippleTransferRate(uTakerGetsIssuerID);
while (!bDone) {
while (!bDone && (iLeft > 0)) {
if (bDirectAdvance) {
bDirectAdvance = false;
@@ -1896,7 +1898,7 @@ void NetworkOPs::getBookPage(Ledger::pointer lpLedger, const uint160& uTakerPays
if (!bDone)
{
SLE::pointer sleOffer = lesActive.entryCache(ltOFFER, uOfferIndex);
const uint160 uOfferOwnerID = sleOffer->getFieldAccount(sfAccount).getAccountID();
const uint160 uOfferOwnerID = sleOffer->getFieldAccount160(sfAccount);
const STAmount& saTakerGets = sleOffer->getFieldAmount(sfTakerGets);
const STAmount& saTakerPays = sleOffer->getFieldAmount(sfTakerPays);
STAmount saOwnerFunds;
@@ -1985,6 +1987,7 @@ void NetworkOPs::getBookPage(Ledger::pointer lpLedger, const uint160& uTakerPays
// Only provide funded offers and offers of the taker.
Json::Value& jvOf = jvOffers.append(jvOffer);
jvOf["quality"] = saDirRate.getText();
--iLeft;
}
if (!lesActive.dirNext(uTipIndex, sleOfferDir, uBookEntry, uOfferIndex))

View File

@@ -212,7 +212,7 @@ TER OfferCreateTransactor::takeOffers(
cLog(lsDEBUG) << "takeOffers: considering offer : " << sleOffer->getJson(0);
const uint160 uOfferOwnerID = sleOffer->getFieldAccount(sfAccount).getAccountID();
const uint160 uOfferOwnerID = sleOffer->getFieldAccount160(sfAccount);
STAmount saOfferPays = sleOffer->getFieldAmount(sfTakerGets);
STAmount saOfferGets = sleOffer->getFieldAmount(sfTakerPays);

View File

@@ -978,7 +978,7 @@ TER RippleCalc::calcNodeAdvance(
{
// Got a new offer.
sleOffer = lesActive.entryCache(ltOFFER, uOfferIndex);
uOfrOwnerID = sleOffer->getFieldAccount(sfAccount).getAccountID();
uOfrOwnerID = sleOffer->getFieldAccount160(sfAccount);
saTakerPays = sleOffer->getFieldAmount(sfTakerPays);
saTakerGets = sleOffer->getFieldAmount(sfTakerGets);
@@ -3136,7 +3136,7 @@ void TransactionEngine::calcOfferBridgeNext(
SLE::pointer sleOffer = entryCache(ltOFFER, uOfferIndex);
uint160 uOfferOwnerID = sleOffer->getFieldAccount(sfAccount).getAccountID();
uint160 uOfferOwnerID = sleOffer->getFieldAccount160(sfAccount);
STAmount saOfferPays = sleOffer->getFieldAmount(sfTakerGets);
STAmount saOfferGets = sleOffer->getFieldAmount(sfTakerPays);

View File

@@ -9,12 +9,11 @@ SETUP_LOG();
bool TransactionEngine::checkInvariants(TER result, const SerializedTransaction& txn, TransactionEngineParams params)
{
#if 0
const RippleAddress& srcAccount = txn.getFieldAccount(sfAccount);
uint32 txnSeq = txn.getFieldU32(sfSequence);
LedgerEntryAction leaAction;
uint256 srcActId = Ledger::getAccountRootIndex(srcAccount.getAccountID());
uint256 srcActId = Ledger::getAccountRootIndex(txn.getFieldAccount(sfAccount));
SLE::pointer origSrcAct = mLedger->getSLE(srcActId);
SLE::pointer newSrcAct = mNodes.getEntry(srcActId, leaAction);

View File

@@ -97,7 +97,7 @@ TER Transactor::checkSig()
{
// Consistency: Check signature
// Verify the transaction's signing public key is the key authorized for signing.
if (mHasAuthKey && mSigningPubKey.getAccountID() == mTxnAccount->getFieldAccount(sfRegularKey).getAccountID())
if (mHasAuthKey && mSigningPubKey.getAccountID() == mTxnAccount->getFieldAccount160(sfRegularKey))
{
// Authorized to continue.
nothing();