Merge pull request #270 from braydonf/bug/block-index

Fix bug with getting a block index with unknown height.
This commit is contained in:
Chris Kleeschulte 2015-10-01 10:11:45 -04:00
commit 3d6efa15a6
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 {