Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

[FIX] fix json rewriter #2538

Merged
merged 1 commit into from
Jun 3, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/js/util/jsonrewriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,14 +435,29 @@ var JsonRewriter = module.exports = {
var low = node.fields.LowLimit;
var viewHigh = high.issuer === account;

var which = obj.transaction.type === 'trusting' ? (viewHigh ? 'HighNoRipple' : 'LowNoRipple') :
// old method, because sometimes there is no transaction
var which = viewHigh ? 'HighNoRipple' : 'LowNoRipple';

if (obj.transaction) {
which = obj.transaction.type === 'trusting' ? (viewHigh ? 'HighNoRipple' : 'LowNoRipple') :
(viewHigh ? 'LowNoRipple' : 'HighNoRipple');
}

// New trust line
if (node.diffType === 'CreatedNode') {
effect.limit = ripple.Amount.from_json(viewHigh ? high : low);
effect.limit_peer = ripple.Amount.from_json(viewHigh ? low : high);

effect.type = obj.transaction.type === 'trusting' ? 'trust_create_local' : 'trust_create_remote';
if (obj.transaction) {
effect.type = obj.transaction.type === 'trusting' ? 'trust_create_local' : 'trust_create_remote';
} else {
if ((high.value > 0 && high.issuer === account)
|| (low.value > 0 && low.issuer === account)) {
effect.type = 'trust_create_local';
} else {
effect.type = 'trust_create_remote';
}
}
}

// Modified trust line
Expand Down