bitcoind: set height when starting
This commit is contained in:
parent
9409374fbe
commit
5932b34a1f
@ -266,14 +266,22 @@ Bitcoin.prototype.start = function(callback) {
|
||||
pass: self.configuration.rpcpassword
|
||||
});
|
||||
|
||||
self.client.getInfo(function(err) {
|
||||
self.client.getBestBlockHash(function(err, response) {
|
||||
if (err) {
|
||||
if (!(err instanceof Error)) {
|
||||
log.warn(err.message);
|
||||
}
|
||||
return done(new Error('Could not connect to bitcoind RPC'));
|
||||
}
|
||||
done();
|
||||
self.client.getBlock(response.result, function(err, response) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
self.height = response.result.height;
|
||||
$.checkState(self.height >= 0);
|
||||
self.emit('tip', self.height);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
}, function ready(err, result) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user