Prevent 'amount' from being misinterpreted (#924)

The 'amount' field should almost never be used.
With partial payments, the field can show an amount that is
significantly less than the amount that the transaction actually
delivered. This change sets amount to 0 XRP when it may be misleading.

This change omits the `amount` when parsing payment transactions.
See `HISTORY.md` for recommended alternatives.
This commit is contained in:
Elliot Lee
2018-08-23 16:17:23 -07:00
committed by GitHub
parent 569766b8f8
commit 181cfd69de
28 changed files with 1301 additions and 738 deletions

View File

@@ -256,7 +256,8 @@ module.exports = function createMockRippled(port) {
createLedgerResponse(request, fixtures.ledger.withoutCloseTime));
} else if (request.ledger_index === 4181996) {
conn.send(createLedgerResponse(request, fixtures.ledger.withSettingsTx));
} else if (request.ledger_index === 100000) {
} else if (request.ledger_index === 22420574 &&
request.expand === true && request.transactions === true) {
conn.send(
createLedgerResponse(request, fixtures.ledger.withPartialPayment));
} else if (request.ledger_index === 100001) {
@@ -266,8 +267,12 @@ module.exports = function createMockRippled(port) {
const response = _.assign({}, fixtures.ledger.normal,
{ result: { ledger: fullLedger } });
conn.send(createLedgerResponse(request, response));
} else {
} else if (request.ledger_index === 'validated' ||
request.ledger_index === 14661789 ||
request.ledger_index === 14661788 /* getTransaction - order */) {
conn.send(createLedgerResponse(request, fixtures.ledger.normal));
} else {
assert(false, 'Unrecognized ledger request: ' + JSON.stringify(request));
}
});