Merge pull request #270 from braydonf/bug/block-index
Fix bug with getting a block index with unknown height.
This commit is contained in:
commit
3d6efa15a6
|
@ -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() {
|
||||
|
|
|
@ -1267,6 +1267,7 @@ NAN_METHOD(GetBlockIndex) {
|
|||
|
||||
if (blockIndex == NULL) {
|
||||
info.GetReturnValue().Set(Null());
|
||||
return;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue