Skip to content

Commit b1b1e17

Browse files
committed
fix(node): fixing the repair script so we can repair while a node is syncing
1 parent bd46b05 commit b1b1e17

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/bitcore-node/src/services/p2p.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ export class P2pWorker {
208208
}
209209

210210
async connect() {
211+
this.setupListeners();
211212
this.pool.connect();
212213
this.connectInterval = setInterval(this.pool.connect.bind(this.pool), 5000);
213214
return new Promise<void>(resolve => {
@@ -446,7 +447,6 @@ export class P2pWorker {
446447

447448
async start() {
448449
logger.debug(`Started worker for chain ${this.chain}`);
449-
this.setupListeners();
450450
await this.connect();
451451
this.registerSyncingNode();
452452
}

packages/bitcore-node/test/verification/db-repair.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import { BlockStorage } from '../../src/models/block';
1818
await Storage.start();
1919
const chainConfig = Config.chainConfig({ chain, network });
2020
const worker = new P2pWorker({ chain, network, chainConfig });
21-
await worker.start();
21+
await worker.connect();
22+
2223
const handleRepair = async data => {
2324
switch (data.type) {
2425
case 'DUPE_COIN':

0 commit comments

Comments
 (0)