mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-24 13:05:53 +00:00
Add fill or kill support.
This commit is contained in:
@@ -342,6 +342,7 @@ TER OfferCreateTransactor::doApply()
|
||||
const uint32 uTxFlags = mTxn.getFlags();
|
||||
const bool bPassive = isSetBit(uTxFlags, tfPassive);
|
||||
const bool bImmediateOrCancel = isSetBit(uTxFlags, tfImmediateOrCancel);
|
||||
const bool bFillOrKill = isSetBit(uTxFlags, tfFillOrKill);
|
||||
STAmount saTakerPays = mTxn.getFieldAmount(sfTakerPays);
|
||||
STAmount saTakerGets = mTxn.getFieldAmount(sfTakerGets);
|
||||
|
||||
@@ -374,6 +375,12 @@ TER OfferCreateTransactor::doApply()
|
||||
|
||||
return temINVALID_FLAG;
|
||||
}
|
||||
else if (bImmediateOrCancel && bFillOrKill)
|
||||
{
|
||||
cLog(lsINFO) << "OfferCreate: Malformed transaction: both IoC and FoK set.";
|
||||
|
||||
return temINVALID_FLAG;
|
||||
}
|
||||
else if (bHaveExpiration && !uExpiration)
|
||||
{
|
||||
cLog(lsWARNING) << "OfferCreate: Malformed offer: bad expiration";
|
||||
@@ -490,6 +497,11 @@ TER OfferCreateTransactor::doApply()
|
||||
// If ledger is not final, can vote no.
|
||||
terResult = bOpenLedger ? telFAILED_PROCESSING : tecFAILED_PROCESSING;
|
||||
}
|
||||
else if (bFillOrKill && (saTakerPays || saTakerGets))
|
||||
{
|
||||
// Fill or kill and have leftovers.
|
||||
terResult = tecKILL;
|
||||
}
|
||||
else if (
|
||||
!saTakerPays // Wants nothing more.
|
||||
|| !saTakerGets // Offering nothing more.
|
||||
|
||||
Reference in New Issue
Block a user