Add sanity check for uint32 uid overflow

This commit is contained in:
Mononaut committed 2023-07-03 10:18:19 -04:00
1 parent fc504012d5
commit 6829e67e15
1 file changed
+4
+4
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);