refactor: consensus_optimistic_update should return client.latestOptimisticUpdate if it is set or return an error
This commit is contained in:
parent
2cd40af902
commit
7cdd7d9531
|
@ -10,7 +10,7 @@
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@lumeweb/interface-relay": "^0.0.2-develop.1",
|
"@lumeweb/interface-relay": "^0.0.2-develop.1",
|
||||||
"@lumeweb/libethsync": "^0.1.0-develop.16",
|
"@lumeweb/libethsync": "^0.1.0-develop.17",
|
||||||
"axios": "^1.4.0"
|
"axios": "^1.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -4123,9 +4123,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@lumeweb/libethsync": {
|
"node_modules/@lumeweb/libethsync": {
|
||||||
"version": "0.1.0-develop.16",
|
"version": "0.1.0-develop.25",
|
||||||
"resolved": "https://registry.npmjs.org/@lumeweb/libethsync/-/libethsync-0.1.0-develop.16.tgz",
|
"resolved": "https://registry.npmjs.org/@lumeweb/libethsync/-/libethsync-0.1.0-develop.25.tgz",
|
||||||
"integrity": "sha512-0m6GD9hkYtYQBhBTQ9ZK1VeJ84zyyocFwIBaFuXibxdxTzT3dqK10TYZgYjnstQVgsWI4O1v2irWcB8wp965dQ==",
|
"integrity": "sha512-yn3uzWCg1kAWWLyhlbrAKEAydhh3IB4aFE2Y2Yz0cpgQgfnsXLQwFF35VmCIIye908yLYc9aGmCgVvPqRkEz5Q==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@chainsafe/as-sha256": "^0.3.1",
|
"@chainsafe/as-sha256": "^0.3.1",
|
||||||
"@chainsafe/bls": "7.1.1",
|
"@chainsafe/bls": "7.1.1",
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@lumeweb/interface-relay": "^0.0.2-develop.1",
|
"@lumeweb/interface-relay": "^0.0.2-develop.1",
|
||||||
"@lumeweb/libethsync": "^0.1.0-develop.16",
|
"@lumeweb/libethsync": "^0.1.0-develop.17",
|
||||||
"axios": "^1.4.0"
|
"axios": "^1.4.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,12 @@ const plugin: Plugin = {
|
||||||
api.registerMethod("consensus_optimistic_update", {
|
api.registerMethod("consensus_optimistic_update", {
|
||||||
cacheable: false,
|
cacheable: false,
|
||||||
async handler(): Promise<object> {
|
async handler(): Promise<object> {
|
||||||
return getConsensusOptimisticUpdate();
|
console.log("consensus_optimistic_update request received");
|
||||||
|
if (!client.latestOptimisticUpdate) {
|
||||||
|
throw new Error("optimistic update not ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
return client.latestOptimisticUpdate;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue