diff --git a/app/modules/ws2p/lib/WS2PCluster.ts b/app/modules/ws2p/lib/WS2PCluster.ts index 6467efd6ce6a4d644a103fd86e3aa31f8253f7dc..8c4bc952d98d453e51f85980f7d786cbbed1c3ee 100644 --- a/app/modules/ws2p/lib/WS2PCluster.ts +++ b/app/modules/ws2p/lib/WS2PCluster.ts @@ -142,7 +142,7 @@ export class WS2PCluster { } const [,,, pub, blockstamp, ws2pId,,,,,]:string[] = messageV2.split(':') const fullId = [pub, ws2pId].join('-') - this.headReceived(messageV2, sigV2, pub, fullId, blockstamp) + this.headReceived(messageV2, sigV2, pub, fullId, blockstamp, step) } if (!message) { throw "EMPTY_MESSAGE_FOR_HEAD" @@ -170,7 +170,7 @@ export class WS2PCluster { this.newHeads = [] } - private async headReceived(message:string, sig:string, pub:string, fullId:string, blockstamp:string) { + private async headReceived(message:string, sig:string, pub:string, fullId:string, blockstamp:string, step?:number) { try { const sigOK = verify(message, sig, pub) if (sigOK) { @@ -183,8 +183,8 @@ export class WS2PCluster { if (isAllowed) { const exists = await this.existsBlock(blockstamp) if (exists) { - this.headsCache[fullId] = { blockstamp, message, sig } - this.newHeads.push({message, sig}) + this.headsCache[fullId] = { blockstamp, message, sig, step } + this.newHeads.push({message, sig, step}) // Cancel a pending "heads" to be spread if (this.headsTimeout) { clearTimeout(this.headsTimeout)