Add sanity check for uint32 uid overflow

This commit is contained in:
Mononaut 2023-06-25 20:38:18 -04:00
parent fc504012d5
commit 6829e67e15
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E

View File

@ -374,6 +374,10 @@ class MempoolBlocks {
}
public async $rustUpdateBlockTemplates(newMempool: { [txid: string]: MempoolTransactionExtended }, added: MempoolTransactionExtended[], removed: MempoolTransactionExtended[]): Promise<void> {
// sanity check to avoid approaching uint32 uid overflow
if (this.nextUid > 4_000_000_000) {
this.resetRustGbt();
}
if (!this.rustInitialized) {
// need to reset the worker
await this.$rustMakeBlockTemplates(newMempool, true);