Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/lib/blockchain/verified.js b/lib/blockchain/verified.js
- index e07613e..0ac0bfa 100644
- --- a/lib/blockchain/verified.js
- +++ b/lib/blockchain/verified.js
- @@ -230,11 +230,18 @@ function Verified (connector, opts) {
- })
- .then(function () {
- function onConnect () {
- - self.connector.getHeader('latest')
- - .then(function (header) {
- - return syncBlockchain(header.hash, header.height)
- - })
- - .catch(function (err) { self.emit('error', err) })
- + Promise.try(function () {
- + if (!self.isSyncing()) {
- + self.emit('syncStart')
- + }
- + })
- + .then(function () {
- + return self.connector.getHeader('latest')
- + })
- + .then(function (header) {
- + return syncBlockchain(header.hash, header.height)
- + })
- + .catch(function (err) { self.emit('error', err) })
- }
- // run syncing using latest
- @@ -258,11 +265,6 @@ function Verified (connector, opts) {
- .catch(function (err) { self.emit('error', err) })
- })
- })
- - .finally(function () {
- - if (self.isSyncing()) {
- - self.emit('syncStop')
- - }
- - })
- }
- inherits(Verified, Blockchain)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement