Skip to content

Commit

Permalink
[TASK] change default max_fee for Remote to 1 XRP
Browse files Browse the repository at this point in the history
  • Loading branch information
geertweening committed Nov 18, 2014
1 parent bc5dcc3 commit d6b1728
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/js/ripple/remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function Remote(opts, trace) {
this.canonical_signing = (typeof opts.canonical_signing === 'boolean') ? opts.canonical_signing : true;

this.fee_cushion = (typeof opts.fee_cushion === 'number') ? opts.fee_cushion : 1.2;
this.max_fee = (typeof opts.max_fee === 'number') ? opts.max_fee : Infinity;
this.max_fee = (typeof opts.max_fee === 'number') ? opts.max_fee : 1000000; // default max fee is 1 XRP, 10^6 drops

this.max_attempts = (typeof opts.max_attempts === 'number') ? opts.max_attempts : 10;

Expand Down
42 changes: 35 additions & 7 deletions test/remote-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ describe('Remote', function () {

it('remote server initialization - url object', function() {
var remote = new Remote({
servers: [ { host: 's-west.ripple.com', port: 443, secure: true } ],
servers: [ { host: 's-west.ripple.com', port: 443, secure: true } ]
});
assert(Array.isArray(remote._servers));
assert(remote._servers[0] instanceof Server);
assert.strictEqual(remote._servers[0]._url, 'wss://s-west.ripple.com:443');
})
});

it('remote server initialization - url object - no secure property', function() {
var remote = new Remote({
Expand All @@ -56,7 +56,7 @@ describe('Remote', function () {
assert(Array.isArray(remote._servers));
assert(remote._servers[0] instanceof Server);
assert.strictEqual(remote._servers[0]._url, 'wss://s-west.ripple.com:443');
})
});

it('remote server initialization - url object - secure: false', function() {
var remote = new Remote({
Expand All @@ -74,7 +74,7 @@ describe('Remote', function () {
assert(Array.isArray(remote._servers));
assert(remote._servers[0] instanceof Server);
assert.strictEqual(remote._servers[0]._url, 'wss://s-west.ripple.com:443');
})
});

it('remote server initialization - url object - invalid host', function() {
assert.throws(
Expand All @@ -83,7 +83,7 @@ describe('Remote', function () {
servers: [ { host: '+', port: 443, secure: true } ]
});
}, Error);
})
});

it('remote server initialization - url object - invalid port', function() {
assert.throws(
Expand Down Expand Up @@ -151,6 +151,34 @@ describe('Remote', function () {
);
});

it('remote server initialization - set max_fee - number', function() {
var remote = new Remote({
max_fee: 10
});
assert.strictEqual(remote.max_fee, 10);

remote = new Remote({
max_fee: 1234567890
});
assert.strictEqual(remote.max_fee, 1234567890);
});

it('remote server initialization - set max_fee - string fails, should be number', function() {
var remote = new Remote({
max_fee: '1234567890'
});
assert.strictEqual(remote.max_fee, 1e6);
});

it('remote server initialization - max_fee - default', function() {
var remote = new Remote({
max_fee: void(0)
});
assert.strictEqual(remote.max_fee, 1e6);
assert.strictEqual(remote.max_fee, 1000000);
assert.strictEqual((new Remote()).max_fee, 1e6);
});

describe('request constructors', function () {
beforeEach(function () {
callback = function () {}
Expand Down Expand Up @@ -489,9 +517,9 @@ describe('Remote', function () {
},
parseJson: function(json) {}
}
}
};
remote.getPendingTransactions();

})
})
})
});

0 comments on commit d6b1728

Please sign in to comment.