Skip to content

Commit e5d6b16

Browse files
committed
style: consider ENV network
1 parent 9b83c74 commit e5d6b16

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/chainhook/server.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ export async function startChainhookServer(args: { db: PgStore }): Promise<Chain
6969
node_type: 'chainhook',
7070
predicate_re_register_callback: async predicate => {
7171
const blockHeight = await args.db.getChainTipBlockHeight();
72-
if (predicate.networks.mainnet) {
73-
predicate.networks.mainnet.start_block = blockHeight;
74-
}
75-
if (predicate.networks.testnet) {
76-
predicate.networks.testnet.start_block = blockHeight;
72+
switch (ENV.NETWORK) {
73+
case 'mainnet':
74+
if (predicate.networks.mainnet) predicate.networks.mainnet.start_block = blockHeight;
75+
break;
76+
case 'testnet':
77+
if (predicate.networks.testnet) predicate.networks.testnet.start_block = blockHeight;
78+
break;
7779
}
7880
return predicate as Predicate;
7981
},

0 commit comments

Comments
 (0)