Skip to content

Updated fee service and cleaned console log from header service #509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 25, 2017
Merged
Show file tree
Hide file tree
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
5 changes: 2 additions & 3 deletions lib/services/fee/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var FeeService = function(options) {
pass: 'local321',
host: 'localhost',
protocol: 'http',
port: this._getDefaultPort()
port: 8332
};
BaseService.call(this, options);

Expand All @@ -34,8 +34,7 @@ FeeService.prototype.stop = function(callback) {

FeeService.prototype.getAPIMethods = function() {
return [
['estimateFee', this, this.estimateFee, 1],
['syncPercentage', this, this.syncPercentage, 0]
['estimateFee', this, this.estimateFee, 1]
];
};

Expand Down
2 changes: 0 additions & 2 deletions lib/services/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ HeaderService.STARTING_CHAINWORK = '00000000000000000000000000000000000000000000

// --- public prototype functions
HeaderService.prototype.subscribe = function(name, emitter) {

console.log(this.subscriptions, name);
this.subscriptions[name].push(emitter);
log.info(emitter.remoteAddress, 'subscribe:', 'header/' + name, 'total:', this.subscriptions[name].length);

Expand Down
47 changes: 47 additions & 0 deletions test/services/fee/index.unit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
'use strict';

var sinon = require('sinon');
var FeeService = require('../../../lib/services/fee');

var expect = require('chai').expect;

describe.only('#Fee Service', function() {
var feeService;
var sandbox;
beforeEach(function() {
sandbox = sinon.sandbox.create();
feeService = new FeeService({
"rpc": {
"user": "bitcoin",
"pass": "local321",
"host": "localhost",
"protocol": "http",
"port": 8332
}
});
});

afterEach(function() {
sandbox.restore();
});

/*
Running in regtest mode or unsync'd will return -1
*/

it("Has an estimateFee method", function() {
var method = feeService.getAPIMethods()[0][0];
expect(method).to.equal('estimateFee');
})

it("Can estimate fees", function(done) {
feeService.estimateFee(4, function(err, fee) {
expect(err).to.be.a('null');
expect(fee.result).to.exist;
expect(fee.result).to.be.at.least(-1);
done();
});
})


});