[stellar/stellar-core] Asset backed offers (#1718)

MonsieurNicolas commented on this pull request.

> + TestMarket market(*app);
+
+ auto cur1 = acc1.asset(“CUR1”);
+ market.requireChangesWithOffer({}, [&] {
+ return market.addOffer(acc1, {native, cur1, Price{1, 1}, 500},
+ {native, cur1, Price{1, 1}, 500});
+ });
+
+ for_versions({2}, *app, [&] {
+ acc1.manageData(t1, &value);
+ });
+ for_versions(4, 9, *app, [&] {
+ acc1.manageData(t1, &value);
+ });
+ for_versions_from(10, *app, [&] {
+ REQUIRE_THROWS_AS(acc1.manageData(t1, &value),

nice, I was thinking that we need to cover this in general

> @@ -124,6 +124,56 @@ TEST_CASE(“payment”, “[tx][payment]”)
ex_CREATE_ACCOUNT_LOW_RESERVE);
});
}
+
+ SECTION(“with native selling liabilities”)
+ {
+ auto const minBal0 = app->getLedgerManager().getMinBalance(0);
+ auto const minBal3 = app->getLedgerManager().getMinBalance(3);
+
+ auto txfee = app->getLedgerManager().getTxFee();

`txfee`: this is redefining/shadowing line 43 (can be removed)

>
+ LedgerHeader previousHeader = getCurrentLedgerHeader();
+ try
+ {
+ soci::transaction upgradeScope(getDatabase().getSession());
+ LedgerDelta upgradeDelta(ledgerDelta);
+ Upgrades::applyTo(lupgrade, *this, upgradeDelta);
+ // Note: Index from 1 rather than 0 to match the behavior of
+ // storeTransaction and storeTransactionFee.
+ Upgrades::storeUpgradeHistory(*this, lupgrade,
+ upgradeDelta.getChanges(), i + 1);

`i+1` is of type `size_t` – yet `storeUpgradeHistory` takes an `int`, so this triggers a warning

> + getCurrentLedgerHeader() = previousHeader;
+ }
+ catch (…)
+ {
+ CLOG(ERROR, “Ledger”)

This post was last modified on July 7, 2018, 12:31 am