diff --git a/lib/electrumx_rpc/cached_electrumx.dart b/lib/electrumx_rpc/cached_electrumx.dart index a8136dcaf..3bce4a910 100644 --- a/lib/electrumx_rpc/cached_electrumx.dart +++ b/lib/electrumx_rpc/cached_electrumx.dart @@ -9,6 +9,7 @@ */ import 'dart:convert'; +import 'dart:math'; import 'package:stackwallet/db/hive/db.dart'; import 'package:stackwallet/electrumx_rpc/electrumx.dart'; @@ -167,8 +168,10 @@ class CachedElectrumX { Set cachedSerials = _list == null ? {} : List.from(_list).toSet(); - final startNumber = - cachedSerials.length - 10; // 10 being some arbitrary buffer + startNumber = max( + max(0, startNumber), + cachedSerials.length - 100, // 100 being some arbitrary buffer + ); final serials = await electrumXClient.getUsedCoinSerials( startNumber: startNumber,