Skip to content

Commit

Permalink
fix(node): fixing the repair script so we can repair while a node is …
Browse files Browse the repository at this point in the history
…syncing
  • Loading branch information
micahriggan committed Jan 28, 2019
1 parent bd46b05 commit b1b1e17
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/bitcore-node/src/services/p2p.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ export class P2pWorker {
}

async connect() {
this.setupListeners();
this.pool.connect();
this.connectInterval = setInterval(this.pool.connect.bind(this.pool), 5000);
return new Promise<void>(resolve => {
Expand Down Expand Up @@ -446,7 +447,6 @@ export class P2pWorker {

async start() {
logger.debug(`Started worker for chain ${this.chain}`);
this.setupListeners();
await this.connect();
this.registerSyncingNode();
}
Expand Down
3 changes: 2 additions & 1 deletion packages/bitcore-node/test/verification/db-repair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import { BlockStorage } from '../../src/models/block';
await Storage.start();
const chainConfig = Config.chainConfig({ chain, network });
const worker = new P2pWorker({ chain, network, chainConfig });
await worker.start();
await worker.connect();

const handleRepair = async data => {
switch (data.type) {
case 'DUPE_COIN':
Expand Down

0 comments on commit b1b1e17

Please sign in to comment.