Skip to content

Use logical timestamps to display blocks #473

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

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 6 additions & 2 deletions lib/services/bitcoind.js
Original file line number Diff line number Diff line change
Expand Up @@ -1691,9 +1691,13 @@ Bitcoin.prototype.getBlock = function(blockArg, callback) {
* @param {Number} low - The older timestamp in seconds
* @param {Function} callback
*/
Bitcoin.prototype.getBlockHashesByTimestamp = function(high, low, callback) {
Bitcoin.prototype.getBlockHashesByTimestamp = function(high, low, options, callback) {
var self = this;
self.client.getBlockHashes(high, low, function(err, response) {
if (_.isFunction(options)) {
callback = options;
options = {};
}
self.client.getBlockHashes(high, low, options, function(err, response) {
if (err) {
return callback(self._wrapRPCError(err));
}
Expand Down
4 changes: 2 additions & 2 deletions test/services/bitcoind.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3944,7 +3944,7 @@ describe('Bitcoin Service', function() {
describe('#getBlockHashesByTimestamp', function() {
it('should give an rpc error', function(done) {
var bitcoind = new BitcoinService(baseConfig);
var getBlockHashes = sinon.stub().callsArgWith(2, {message: 'error', code: -1});
var getBlockHashes = sinon.stub().callsArgWith(3, {message: 'error', code: -1});
bitcoind.nodes.push({
client: {
getBlockHashes: getBlockHashes
Expand All @@ -3960,7 +3960,7 @@ describe('Bitcoin Service', function() {
var bitcoind = new BitcoinService(baseConfig);
var block1 = '00000000050a6d07f583beba2d803296eb1e9d4980c4a20f206c584e89a4f02b';
var block2 = '000000000383752a55a0b2891ce018fd0fdc0b6352502772b034ec282b4a1bf6';
var getBlockHashes = sinon.stub().callsArgWith(2, null, {
var getBlockHashes = sinon.stub().callsArgWith(3, null, {
result: [block2, block1]
});
bitcoind.nodes.push({
Expand Down