Skip to content

Commit 4b2005b

Browse files
committed
skip network merge on single network node
1 parent ae8d4a7 commit 4b2005b

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ async function gracefulShutdown(signal: string) {
878878
const forceExitTimeout = setTimeout(() => {
879879
console.log("[SHUTDOWN] Timeout exceeded, forcing exit...")
880880
process.exit(0)
881-
}, 10_000)
881+
}, 5_000)
882882
// Don't let this timer itself keep the process alive
883883
if (forceExitTimeout.unref) forceExitTimeout.unref()
884884

src/libs/consensus/v2/routines/mergeMempools.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
import { Peer } from "@/libs/peer"
22
import log from "@/utilities/logger"
33
import Mempool from "@/libs/blockchain/mempool_v2"
4-
import { RPCRequest, RPCResponse, Transaction } from "@kynesyslabs/demosdk/types"
4+
import {
5+
RPCRequest,
6+
RPCResponse,
7+
Transaction,
8+
} from "@kynesyslabs/demosdk/types"
9+
import { getSharedState } from "@/utilities/sharedState"
510

611
export async function mergeMempools(mempool: Transaction[], shard: Peer[]) {
12+
// INFO: if shard only contains us, skip network requests
13+
if (
14+
shard.length === 1 &&
15+
shard[0].identity === getSharedState.publicKeyHex
16+
) {
17+
return
18+
}
19+
720
const promises: Promise<RPCResponse>[] = []
821
const request: RPCRequest = {
922
method: "mempool",

0 commit comments

Comments
 (0)