Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
danield9tqh committed Sep 6, 2023
1 parent b8602db commit b8bd336
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions ironfish/src/network/blockFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ type BlockState =
| {
action: 'PROCESSING_FULL_BLOCK'
block: Block
firstSeenBy?: Identity
firstSeenBy: Identity | null
}

export class BlockFetcher {
Expand Down Expand Up @@ -231,9 +231,9 @@ export class BlockFetcher {
/**
* Return the first peer that notified us of this block
*/
firstSeenBy(hash: BlockHash): Identity | undefined {
firstSeenBy(hash: BlockHash): Identity | null {
const currentState = this.pending.get(hash)
return currentState?.firstSeenBy
return currentState ? currentState.firstSeenBy : null
}

requestBlockTransactions(
Expand Down Expand Up @@ -389,7 +389,7 @@ export class BlockFetcher {
this.pending.set(hash, {
action: 'PROCESSING_FULL_BLOCK',
block,
firstSeenBy: currentState?.firstSeenBy ?? peer.state.identity ?? undefined,
firstSeenBy: currentState?.firstSeenBy ?? peer.state.identity ?? null,
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions ironfish/src/telemetry/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ export class Telemetry {
})
}

submitNewBlockSeen(block: Block, seenAt: Date, peerId?: Identity): void {
submitNewBlockSeen(block: Block, seenAt: Date, peerId: Identity | null): void {
this.submit({
measurement: 'block_propagation',
timestamp: seenAt,
Expand All @@ -422,7 +422,7 @@ export class Telemetry {
{
name: 'firstSeenBy',
type: 'string',
value: peerId || '',
value: peerId ?? '',
},
{
name: 'sequence',
Expand Down

0 comments on commit b8bd336

Please sign in to comment.