Compare commits
3 Commits
v0.1.0-dev
...
v0.1.0-dev
Author | SHA1 | Date |
---|---|---|
semantic-release-bot | 3bf72603bb | |
Derrick Hammer | 75ed669eb7 | |
Derrick Hammer | cfa1462505 |
|
@ -1,3 +1,5 @@
|
|||
# [0.1.0-develop.33](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.32...v0.1.0-develop.33) (2023-07-13)
|
||||
|
||||
# [0.1.0-develop.32](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.31...v0.1.0-develop.32) (2023-07-13)
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@lumeweb/libethclient",
|
||||
"version": "0.1.0-develop.32",
|
||||
"version": "0.1.0-develop.33",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@lumeweb/libethclient",
|
||||
"version": "0.1.0-develop.32",
|
||||
"version": "0.1.0-develop.33",
|
||||
"dependencies": {
|
||||
"@chainsafe/as-sha256": "^0.3.1",
|
||||
"@chainsafe/bls": "7.1.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lumeweb/libethsync",
|
||||
"version": "0.1.0-develop.32",
|
||||
"version": "0.1.0-develop.33",
|
||||
"type": "module",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -44,16 +44,34 @@ export default class Prover implements IProver {
|
|||
}
|
||||
}
|
||||
|
||||
const res = await this.callback({
|
||||
start: trueStart,
|
||||
count: trueCount,
|
||||
});
|
||||
const existingUpdates: LightClientUpdate[] = [];
|
||||
const results: Uint8Array[][] = [];
|
||||
|
||||
const updates: LightClientUpdate[] = [];
|
||||
let batchedStart = trueStart;
|
||||
let batchedCount = trueCount;
|
||||
|
||||
while (true) {
|
||||
const res = await this.callback({
|
||||
start: batchedStart,
|
||||
count: batchedCount,
|
||||
});
|
||||
|
||||
if (res.length <= batchedCount) {
|
||||
if (res.length > 0) {
|
||||
results.push(res);
|
||||
batchedStart += res.length;
|
||||
batchedCount -= res.length;
|
||||
}
|
||||
}
|
||||
|
||||
if (batchedCount == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (trueStart != startPeriod) {
|
||||
for (let i = 0; i < trueStart - startPeriod; i++) {
|
||||
updates.push(
|
||||
existingUpdates.push(
|
||||
capella.ssz.LightClientUpdate.deserialize(
|
||||
this.client.store.getUpdate(startPeriod + i),
|
||||
),
|
||||
|
@ -61,8 +79,12 @@ export default class Prover implements IProver {
|
|||
}
|
||||
}
|
||||
|
||||
return updates.concat(
|
||||
res.map((u: any) => capella.ssz.LightClientUpdate.fromJson(u.data)),
|
||||
return existingUpdates.concat(
|
||||
results
|
||||
.reduce((prev, cur) => {
|
||||
return prev.concat(cur);
|
||||
}, [])
|
||||
.map((u: any) => capella.ssz.LightClientUpdate.fromJson(u.data)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue