Skip to content

Commit 3148ccf

Browse files
authored
conditionally logs scan starts and ends (#5591)
only logs scan starts and ends in debug output if the start and end sequences differ reduces noise from debug output when running a synced node where each block produces a new scan with equal start and end sequences
1 parent 380f888 commit 3148ccf

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

ironfish/src/wallet/scanner/walletScanner.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,12 @@ export class WalletScanner {
105105
this.state = scan
106106
unlock()
107107

108-
this.logger.debug(
109-
`Scan starting from block ${scan.start.sequence} to ${scan.start.sequence}`,
110-
)
108+
const logScanState = scan.start.sequence !== scan.end.sequence
109+
if (logScanState) {
110+
this.logger.debug(
111+
`Scan starting from block ${scan.start.sequence} to ${scan.end.sequence}`,
112+
)
113+
}
111114

112115
decryptor.start(scan.abortController)
113116

@@ -136,11 +139,13 @@ export class WalletScanner {
136139
await decryptor.flush()
137140
})()
138141
.then(() => {
139-
this.logger.debug(
140-
`Finished scanning for transactions after ${Math.floor(
141-
(Date.now() - scan.startedAt) / 1000,
142-
)} seconds`,
143-
)
142+
if (logScanState) {
143+
this.logger.debug(
144+
`Finished scanning for transactions after ${Math.floor(
145+
(Date.now() - scan.startedAt) / 1000,
146+
)} seconds`,
147+
)
148+
}
144149
})
145150
.finally(() => {
146151
decryptor.stop()

0 commit comments

Comments
 (0)