mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Add owner_funds to subscription streams (RIPD-377)
This commit is contained in:
committed by
Vinnie Falco
parent
af7cd3cc04
commit
8368798ad2
@@ -94,7 +94,7 @@ void AcceptedLedgerTx::buildJson ()
|
||||
LedgerEntrySet les (mLedger, tapNONE, true);
|
||||
auto const ownerFunds (les.accountFunds (account, amount, fhIGNORE_FREEZE));
|
||||
|
||||
mJson[jss::owner_funds] = ownerFunds.getText ();
|
||||
mJson[jss::transaction][jss::owner_funds] = ownerFunds.getText ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2619,12 +2619,12 @@ void NetworkOPsImp::reportFeeChange ()
|
||||
std::bind (&NetworkOPsImp::pubServer, this));
|
||||
}
|
||||
|
||||
Json::Value NetworkOPsImp::transJson (
|
||||
// This routine should only be used to publish accepted or validated
|
||||
// transactions.
|
||||
Json::Value NetworkOPsImp::transJson(
|
||||
const SerializedTransaction& stTxn, TER terResult, bool bValidated,
|
||||
Ledger::ref lpCurrent)
|
||||
{
|
||||
// This routine should only be used to publish accepted or validated
|
||||
// transactions.
|
||||
Json::Value jvObj (Json::objectValue);
|
||||
std::string sToken;
|
||||
std::string sHuman;
|
||||
@@ -2655,6 +2655,21 @@ Json::Value NetworkOPsImp::transJson (
|
||||
jvObj[jss::engine_result_code] = terResult;
|
||||
jvObj[jss::engine_result_message] = sHuman;
|
||||
|
||||
if (stTxn.getTxnType() == ttOFFER_CREATE)
|
||||
{
|
||||
auto const account (stTxn.getSourceAccount ().getAccountID ());
|
||||
auto const amount (stTxn.getFieldAmount (sfTakerGets));
|
||||
|
||||
// If the offer create is not self funded then add the owner balance
|
||||
if (account != amount.issue ().account)
|
||||
{
|
||||
LedgerEntrySet les (lpCurrent, tapNONE, true);
|
||||
auto const ownerFunds (les.accountFunds (account, amount, fhIGNORE_FREEZE));
|
||||
|
||||
jvObj[jss::transaction][jss::owner_funds] = ownerFunds.getText ();
|
||||
}
|
||||
}
|
||||
|
||||
return jvObj;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user