Skip to content

Commit ed597e5

Browse files
miguelportillavinniefalco
authored andcommitted
Add owner_funds to subscription streams (RIPD-377)
1 parent 2c88c15 commit ed597e5

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

src/ripple/module/app/ledger/AcceptedLedgerTx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void AcceptedLedgerTx::buildJson ()
9494
LedgerEntrySet les (mLedger, tapNONE, true);
9595
auto const ownerFunds (les.accountFunds (account, amount, fhIGNORE_FREEZE));
9696

97-
mJson[jss::owner_funds] = ownerFunds.getText ();
97+
mJson[jss::transaction][jss::owner_funds] = ownerFunds.getText ();
9898
}
9999
}
100100
}

src/ripple/module/app/misc/NetworkOPs.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2620,12 +2620,12 @@ void NetworkOPsImp::reportFeeChange ()
26202620
std::bind (&NetworkOPsImp::pubServer, this));
26212621
}
26222622

2623-
Json::Value NetworkOPsImp::transJson (
2623+
// This routine should only be used to publish accepted or validated
2624+
// transactions.
2625+
Json::Value NetworkOPsImp::transJson(
26242626
const SerializedTransaction& stTxn, TER terResult, bool bValidated,
26252627
Ledger::ref lpCurrent)
26262628
{
2627-
// This routine should only be used to publish accepted or validated
2628-
// transactions.
26292629
Json::Value jvObj (Json::objectValue);
26302630
std::string sToken;
26312631
std::string sHuman;
@@ -2656,6 +2656,21 @@ Json::Value NetworkOPsImp::transJson (
26562656
jvObj[jss::engine_result_code] = terResult;
26572657
jvObj[jss::engine_result_message] = sHuman;
26582658

2659+
if (stTxn.getTxnType() == ttOFFER_CREATE)
2660+
{
2661+
auto const account (stTxn.getSourceAccount ().getAccountID ());
2662+
auto const amount (stTxn.getFieldAmount (sfTakerGets));
2663+
2664+
// If the offer create is not self funded then add the owner balance
2665+
if (account != amount.issue ().account)
2666+
{
2667+
LedgerEntrySet les (lpCurrent, tapNONE, true);
2668+
auto const ownerFunds (les.accountFunds (account, amount, fhIGNORE_FREEZE));
2669+
2670+
jvObj[jss::transaction][jss::owner_funds] = ownerFunds.getText ();
2671+
}
2672+
}
2673+
26592674
return jvObj;
26602675
}
26612676

0 commit comments

Comments
 (0)