Keep currentBlockHeight in services

This commit is contained in:
Sosthene 2025-08-23 16:02:31 +02:00
parent 7100eda272
commit 3ce412d814

View File

@ -30,6 +30,7 @@ export default class Services {
private routingInstance!: ModalService;
private relayAddresses: { [wsurl: string]: string } = {};
private membersList: Record<string, Member> = {};
private currentBlockHeight: number = -1;
// Private constructor to prevent direct instantiation from outside
private constructor() {}
@ -1321,6 +1322,7 @@ export default class Services {
try {
const handshakeMsg: HandshakeMessage = JSON.parse(parsedMsg);
this.updateRelay(url, handshakeMsg.sp_address);
this.currentBlockHeight = handshakeMsg.chain_tip;
if (this.membersList && Object.keys(this.membersList).length === 0) {
// We start from an empty list, just copy it over
this.membersList = handshakeMsg.peers_list;