mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 03:49:22 +00:00
fix: updated spark data calls and caching
This commit is contained in:
parent
d6aec00b58
commit
ae10bef0ee
3 changed files with 27 additions and 12 deletions
|
@ -47,9 +47,18 @@ abstract class FiroCacheCoordinator {
|
|||
final setMetaSize =
|
||||
(await setMetaCacheFile.exists()) ? await setMetaCacheFile.length() : 0;
|
||||
|
||||
print("TAG SIZE: $tagsSize");
|
||||
print("SET SIZE: $setSize");
|
||||
print("SET META SIZE: $setMetaSize");
|
||||
Logging.instance.log(
|
||||
"Spark cache used tags size: $tagsSize",
|
||||
level: LogLevel.Debug,
|
||||
);
|
||||
Logging.instance.log(
|
||||
"Spark cache anon set size: $setSize",
|
||||
level: LogLevel.Debug,
|
||||
);
|
||||
Logging.instance.log(
|
||||
"Spark cache set meta size: $setMetaSize",
|
||||
level: LogLevel.Debug,
|
||||
);
|
||||
|
||||
final int bytes = tagsSize + setSize + setMetaSize;
|
||||
|
||||
|
@ -112,7 +121,7 @@ abstract class FiroCacheCoordinator {
|
|||
startBlockHash: blockHash.toHexReversedFromBase64,
|
||||
);
|
||||
} else {
|
||||
const sectorSize = 100; // TODO adjust this?
|
||||
const sectorSize = 2000; // TODO adjust this?
|
||||
final prevMetaSize =
|
||||
await FiroCacheCoordinator.getSparkMetaSetSizeForGroupId(
|
||||
groupId,
|
||||
|
@ -139,10 +148,11 @@ abstract class FiroCacheCoordinator {
|
|||
final start = (i * sectorSize) + prevSize;
|
||||
final data = await client.getSparkAnonymitySetBySector(
|
||||
coinGroupId: groupId,
|
||||
latestBlock: meta.blockHash,
|
||||
latestBlock: meta.blockHash.toHexReversedFromBase64,
|
||||
startIndex: start,
|
||||
endIndex: start + sectorSize,
|
||||
);
|
||||
progressUpdated.call(start + sectorSize, meta.size);
|
||||
|
||||
coins.addAll(data);
|
||||
}
|
||||
|
@ -150,10 +160,11 @@ abstract class FiroCacheCoordinator {
|
|||
if (remainder > 0) {
|
||||
final data = await client.getSparkAnonymitySetBySector(
|
||||
coinGroupId: groupId,
|
||||
latestBlock: meta.blockHash,
|
||||
latestBlock: meta.blockHash.toHexReversedFromBase64,
|
||||
startIndex: meta.size - remainder,
|
||||
endIndex: meta.size,
|
||||
);
|
||||
progressUpdated.call(meta.size, meta.size);
|
||||
|
||||
coins.addAll(data);
|
||||
}
|
||||
|
|
|
@ -63,9 +63,9 @@ abstract class _Reader {
|
|||
required Database db,
|
||||
}) async {
|
||||
final query = """
|
||||
SELECT ss.size
|
||||
FROM PreviousMetaFetchResult ss
|
||||
WHERE ss.groupId = $groupId;
|
||||
SELECT size
|
||||
FROM PreviousMetaFetchResult
|
||||
WHERE coinGroupId = $groupId;
|
||||
""";
|
||||
|
||||
return db.select("$query;");
|
||||
|
|
|
@ -1193,8 +1193,12 @@ class ElectrumXClient {
|
|||
required int coinGroupId,
|
||||
}) async {
|
||||
try {
|
||||
const command =
|
||||
"spark.getsparkanonyumitysetmeta"; // TODO verify this will be correct
|
||||
const command = "spark.getsparkanonymitysetmeta";
|
||||
Logging.instance.log(
|
||||
"[${getElectrumAdapter()?.host}] => attempting to fetch $command...",
|
||||
level: LogLevel.Info,
|
||||
);
|
||||
|
||||
final start = DateTime.now();
|
||||
final response = await request(
|
||||
requestID: requestID,
|
||||
|
@ -1238,7 +1242,7 @@ class ElectrumXClient {
|
|||
}) async {
|
||||
try {
|
||||
const command =
|
||||
"spark.getsparkanonyumitysetsector"; // TODO verify this will be correct
|
||||
"spark.getsparkanonymitysetsector"; // TODO verify this will be correct
|
||||
final start = DateTime.now();
|
||||
final response = await request(
|
||||
requestID: requestID,
|
||||
|
|
Loading…
Reference in a new issue