Use logical timestamps to display blocks
This commit is contained in:
parent
5cf3d78464
commit
4a99870813
@ -1691,9 +1691,13 @@ Bitcoin.prototype.getBlock = function(blockArg, callback) {
|
|||||||
* @param {Number} low - The older timestamp in seconds
|
* @param {Number} low - The older timestamp in seconds
|
||||||
* @param {Function} callback
|
* @param {Function} callback
|
||||||
*/
|
*/
|
||||||
Bitcoin.prototype.getBlockHashesByTimestamp = function(high, low, callback) {
|
Bitcoin.prototype.getBlockHashesByTimestamp = function(high, low, options, callback) {
|
||||||
var self = this;
|
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) {
|
if (err) {
|
||||||
return callback(self._wrapRPCError(err));
|
return callback(self._wrapRPCError(err));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3944,7 +3944,7 @@ describe('Bitcoin Service', function() {
|
|||||||
describe('#getBlockHashesByTimestamp', function() {
|
describe('#getBlockHashesByTimestamp', function() {
|
||||||
it('should give an rpc error', function(done) {
|
it('should give an rpc error', function(done) {
|
||||||
var bitcoind = new BitcoinService(baseConfig);
|
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({
|
bitcoind.nodes.push({
|
||||||
client: {
|
client: {
|
||||||
getBlockHashes: getBlockHashes
|
getBlockHashes: getBlockHashes
|
||||||
@ -3960,7 +3960,7 @@ describe('Bitcoin Service', function() {
|
|||||||
var bitcoind = new BitcoinService(baseConfig);
|
var bitcoind = new BitcoinService(baseConfig);
|
||||||
var block1 = '00000000050a6d07f583beba2d803296eb1e9d4980c4a20f206c584e89a4f02b';
|
var block1 = '00000000050a6d07f583beba2d803296eb1e9d4980c4a20f206c584e89a4f02b';
|
||||||
var block2 = '000000000383752a55a0b2891ce018fd0fdc0b6352502772b034ec282b4a1bf6';
|
var block2 = '000000000383752a55a0b2891ce018fd0fdc0b6352502772b034ec282b4a1bf6';
|
||||||
var getBlockHashes = sinon.stub().callsArgWith(2, null, {
|
var getBlockHashes = sinon.stub().callsArgWith(3, null, {
|
||||||
result: [block2, block1]
|
result: [block2, block1]
|
||||||
});
|
});
|
||||||
bitcoind.nodes.push({
|
bitcoind.nodes.push({
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user