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

Commit

Permalink
Merge pull request #2538 from darkdarkdragon/json-rewriter-fix
Browse files Browse the repository at this point in the history
[FIX] fix json rewriter
  • Loading branch information
vhpoet committed Jun 3, 2015
2 parents 63397be + 2ff2262 commit 4afcce2
Showing 1 changed file with 17 additions and 2 deletions.
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

0 comments on commit 4afcce2

Please sign in to comment.