Fix bug with getting a block index with unknown height.

This commit is contained in:
Braydon Fuller 2015-10-01 00:21:14 -04:00
parent 2df0bb63b0
commit 1490b17f9a
2 changed files with 14 additions and 0 deletions

View File

@ -184,6 +184,14 @@ describe('Daemon Binding Functionality', function() {
});
});
});
it('will get error with number greater than tip', function(done) {
bitcoind.getBlock(1000000000, function(err, response) {
should.exist(err);
done();
});
});
});
describe('get transactions by hash', function() {
@ -254,6 +262,11 @@ describe('Daemon Binding Functionality', function() {
blockIndex.height.should.equal(i);
});
});
it('will get null with number greater than tip', function(done) {
var index = bitcoind.getBlockIndex(100000);
should.equal(index, null);
done();
});
});
describe('isMainChain', function() {

View File

@ -1267,6 +1267,7 @@ NAN_METHOD(GetBlockIndex) {
if (blockIndex == NULL) {
info.GetReturnValue().Set(Null());
return;
}
} else {