Freeze enforcing: (RIPD-399)

* Set enforce date: September 15, 2014
 * Enforce in stand alone mode
 * Enforce at source
 * Enforce intermediary nodes
 * Enforce global freeze in get paths out
 * Enforce global freeze in create offer
 * Don't consider frozen links a path out
 * Handle in getBookPage
 * Enforce in new offer transactors
This commit is contained in:
David Schwartz
2014-05-27 12:57:49 -07:00
committed by Nik Bougalis
parent 9eb34f542c
commit 7b936de32c
17 changed files with 258 additions and 51 deletions

View File

@@ -3056,6 +3056,9 @@ void NetworkOPsImp::getBookPage (
LedgerEntrySet lesActive (lpLedger, tapNONE, true);
const bool bGlobalFreeze = lesActive.isGlobalFrozen (book.out.account) ||
lesActive.isGlobalFrozen (book.in.account);
bool bDone = false;
bool bDirectAdvance = true;
@@ -3120,6 +3123,12 @@ void NetworkOPsImp::getBookPage (
// funded.
saOwnerFunds = saTakerGets;
}
else if (bGlobalFreeze)
{
// If either asset is globally frozen, consider all offers
// that aren't ours to be totally unfunded
saOwnerFunds.clear (IssueRef (book.out.currency, book.out.account));
}
else
{
auto umBalanceEntry = umBalance.find (uOfferOwnerID);
@@ -3135,7 +3144,7 @@ void NetworkOPsImp::getBookPage (
saOwnerFunds = lesActive.accountHolds (
uOfferOwnerID, book.out.currency,
book.out.account);
book.out.account, fhZERO_IF_FROZEN);
if (saOwnerFunds < zero)
{
@@ -3259,6 +3268,10 @@ void NetworkOPsImp::getBookPage (
auto uTransferRate = lesActive.rippleTransferRate (book.out.account);
const bool bGlobalFreeze = lesActive.isGlobalFrozen (book.out.account) ||
lesActive.isGlobalFrozen (book.in.account);
while (iLeft-- > 0 && obIterator.nextOffer ())
{
@@ -3276,6 +3289,12 @@ void NetworkOPsImp::getBookPage (
// If offer is selling issuer's own IOUs, it is fully funded.
saOwnerFunds = saTakerGets;
}
else if (bGlobalFreeze)
{
// If either asset is globally frozen, consider all offers
// that aren't ours to be totally unfunded
saOwnerFunds.clear (IssueRef (book.out.currency, book.out.account));
}
else
{
auto umBalanceEntry = umBalance.find (uOfferOwnerID);
@@ -3291,7 +3310,7 @@ void NetworkOPsImp::getBookPage (
// Did not find balance in table.
saOwnerFunds = lesActive.accountHolds (
uOfferOwnerID, book.out.currency, book.out.account);
uOfferOwnerID, book.out.currency, book.out.account, fhZERO_IF_FROZEN);
if (saOwnerFunds.isNegative ())
{