mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Add expiration to account_offers (RIPD-1049)
This commit is contained in:
committed by
Nik Bougalis
parent
d5c14755ce
commit
3fa2028eb2
@@ -150,6 +150,7 @@ JSS ( error_exception ); // out: Submit
|
||||
JSS ( error_message ); // out: error
|
||||
JSS ( expand ); // in: handler/Ledger
|
||||
JSS ( expected_ledger_size ); // out: TxQ
|
||||
JSS ( expiration ); // out: AccountOffers
|
||||
JSS ( fail_hard ); // in: Sign, Submit
|
||||
JSS ( failed ); // out: InboundLedger
|
||||
JSS ( feature ); // in: Feature
|
||||
|
||||
@@ -44,6 +44,8 @@ void appendOfferJson (std::shared_ptr<SLE const> const& offer,
|
||||
obj[jss::seq] = offer->getFieldU32 (sfSequence);
|
||||
obj[jss::flags] = offer->getFieldU32 (sfFlags);
|
||||
obj[jss::quality] = dirRate.getText ();
|
||||
if (offer->isFieldPresent(sfExpiration))
|
||||
obj[jss::expiration] = offer->getFieldU32(sfExpiration);
|
||||
};
|
||||
|
||||
// {
|
||||
@@ -120,22 +122,20 @@ Json::Value doAccountOffers (RPC::Context& context)
|
||||
offers.reserve (++reserve);
|
||||
}
|
||||
|
||||
{
|
||||
if (! forEachItemAfter(*ledger, accountID,
|
||||
startAfter, startHint, reserve,
|
||||
[&offers](std::shared_ptr<SLE const> const& offer)
|
||||
{
|
||||
if (offer->getType () == ltOFFER)
|
||||
{
|
||||
offers.emplace_back (offer);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}))
|
||||
if (! forEachItemAfter(*ledger, accountID,
|
||||
startAfter, startHint, reserve,
|
||||
[&offers](std::shared_ptr<SLE const> const& offer)
|
||||
{
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
}
|
||||
if (offer->getType () == ltOFFER)
|
||||
{
|
||||
offers.emplace_back (offer);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}))
|
||||
{
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
}
|
||||
|
||||
if (offers.size () == reserve)
|
||||
@@ -147,9 +147,7 @@ Json::Value doAccountOffers (RPC::Context& context)
|
||||
}
|
||||
|
||||
for (auto const& offer : offers)
|
||||
{
|
||||
appendOfferJson(offer, jsonOffers);
|
||||
}
|
||||
|
||||
context.loadType = Resource::feeMediumBurdenRPC;
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user