Cater for at-genesis best headers (#3264)

This commit is contained in:
Jaco Greeff
2021-03-05 10:28:56 +01:00
committed by GitHub
parent 47f08e9e04
commit a51658ffac
11 changed files with 140 additions and 137 deletions
+2 -2
View File
@@ -19,8 +19,8 @@
"@babel/runtime": "^7.13.9",
"@polkadot/api": "4.0.1-8",
"@polkadot/types": "4.0.1-8",
"@polkadot/util": "^6.0.1-5",
"@polkadot/x-rxjs": "^6.0.1-5",
"@polkadot/util": "^6.0.1-9",
"@polkadot/x-rxjs": "^6.0.1-9",
"bn.js": "^4.11.9"
}
}
+4 -4
View File
@@ -20,13 +20,13 @@
"@polkadot/api": "4.0.1-8",
"@polkadot/rpc-core": "4.0.1-8",
"@polkadot/types": "4.0.1-8",
"@polkadot/util": "^6.0.1-5",
"@polkadot/util-crypto": "^6.0.1-5",
"@polkadot/x-rxjs": "^6.0.1-5",
"@polkadot/util": "^6.0.1-9",
"@polkadot/util-crypto": "^6.0.1-9",
"@polkadot/x-rxjs": "^6.0.1-9",
"bn.js": "^4.11.9"
},
"devDependencies": {
"@polkadot/keyring": "^6.0.1-5",
"@polkadot/keyring": "^6.0.1-9",
"@polkadot/rpc-provider": "4.0.1-8"
}
}
+8 -5
View File
@@ -35,13 +35,16 @@ function signingHeader (api: ApiInterfaceRx): Observable<Header> {
api.rpc.chain.getHeader(),
api.rpc.chain.getFinalizedHead()
]).pipe(
switchMap(([{ parentHash }, finHash]) =>
switchMap(([bestHeader, finHash]) =>
// retrieve the headers - in the case of the current block, we use the parent
// to minimize (not completely remove) the impact that forks do have on the system
combineLatest([
api.rpc.chain.getHeader(parentHash),
api.rpc.chain.getHeader(finHash)
])
// (when at genesis, just return the current header as the last known)
bestHeader.parentHash.isEmpty
? of([bestHeader, bestHeader])
: combineLatest([
api.rpc.chain.getHeader(bestHeader.parentHash),
api.rpc.chain.getHeader(finHash)
])
),
map(([current, finalized]) =>
// determine the hash to use, current when lag > max, else finalized
+4 -4
View File
@@ -18,15 +18,15 @@
"dependencies": {
"@babel/runtime": "^7.13.9",
"@polkadot/api-derive": "4.0.1-8",
"@polkadot/keyring": "^6.0.1-5",
"@polkadot/keyring": "^6.0.1-9",
"@polkadot/metadata": "4.0.1-8",
"@polkadot/rpc-core": "4.0.1-8",
"@polkadot/rpc-provider": "4.0.1-8",
"@polkadot/types": "4.0.1-8",
"@polkadot/types-known": "4.0.1-8",
"@polkadot/util": "^6.0.1-5",
"@polkadot/util-crypto": "^6.0.1-5",
"@polkadot/x-rxjs": "^6.0.1-5",
"@polkadot/util": "^6.0.1-9",
"@polkadot/util-crypto": "^6.0.1-9",
"@polkadot/x-rxjs": "^6.0.1-9",
"bn.js": "^4.11.9",
"eventemitter3": "^4.0.7"
}
+3 -3
View File
@@ -19,11 +19,11 @@
"@babel/runtime": "^7.13.9",
"@polkadot/types": "4.0.1-8",
"@polkadot/types-known": "4.0.1-8",
"@polkadot/util": "^6.0.1-5",
"@polkadot/util-crypto": "^6.0.1-5",
"@polkadot/util": "^6.0.1-9",
"@polkadot/util-crypto": "^6.0.1-9",
"bn.js": "^4.11.9"
},
"devDependencies": {
"@polkadot/keyring": "^6.0.1-5"
"@polkadot/keyring": "^6.0.1-9"
}
}
+3 -3
View File
@@ -20,10 +20,10 @@
"@polkadot/metadata": "4.0.1-8",
"@polkadot/rpc-provider": "4.0.1-8",
"@polkadot/types": "4.0.1-8",
"@polkadot/util": "^6.0.1-5",
"@polkadot/x-rxjs": "^6.0.1-5"
"@polkadot/util": "^6.0.1-9",
"@polkadot/x-rxjs": "^6.0.1-9"
},
"devDependencies": {
"@polkadot/keyring": "^6.0.1-5"
"@polkadot/keyring": "^6.0.1-9"
}
}
+6 -6
View File
@@ -18,16 +18,16 @@
"dependencies": {
"@babel/runtime": "^7.13.9",
"@polkadot/types": "4.0.1-8",
"@polkadot/util": "^6.0.1-5",
"@polkadot/util-crypto": "^6.0.1-5",
"@polkadot/x-fetch": "^6.0.1-5",
"@polkadot/x-global": "^6.0.1-5",
"@polkadot/x-ws": "^6.0.1-5",
"@polkadot/util": "^6.0.1-9",
"@polkadot/util-crypto": "^6.0.1-9",
"@polkadot/x-fetch": "^6.0.1-9",
"@polkadot/x-global": "^6.0.1-9",
"@polkadot/x-ws": "^6.0.1-9",
"bn.js": "^4.11.9",
"eventemitter3": "^4.0.7"
},
"devDependencies": {
"@polkadot/keyring": "^6.0.1-5",
"@polkadot/keyring": "^6.0.1-9",
"@polkadot/metadata": "4.0.1-8",
"mock-socket": "^9.0.3",
"nock": "^13.0.10"
+1 -1
View File
@@ -30,7 +30,7 @@
"@polkadot/metadata": "4.0.1-8",
"@polkadot/rpc-provider": "4.0.1-8",
"@polkadot/types": "4.0.1-8",
"@polkadot/util": "^6.0.1-5",
"@polkadot/util": "^6.0.1-9",
"handlebars": "^4.7.7",
"websocket": "^1.0.33",
"yargs": "^16.2.0"
+2 -2
View File
@@ -17,9 +17,9 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
"dependencies": {
"@babel/runtime": "^7.13.9",
"@polkadot/networks": "^6.0.1-5",
"@polkadot/networks": "^6.0.1-9",
"@polkadot/types": "4.0.1-8",
"@polkadot/util": "^6.0.1-5",
"@polkadot/util": "^6.0.1-9",
"bn.js": "^4.11.9"
},
"devDependencies": {
+4 -4
View File
@@ -18,13 +18,13 @@
"dependencies": {
"@babel/runtime": "^7.13.9",
"@polkadot/metadata": "4.0.1-8",
"@polkadot/util": "^6.0.1-5",
"@polkadot/util-crypto": "^6.0.1-5",
"@polkadot/x-rxjs": "^6.0.1-5",
"@polkadot/util": "^6.0.1-9",
"@polkadot/util-crypto": "^6.0.1-9",
"@polkadot/x-rxjs": "^6.0.1-9",
"@types/bn.js": "^4.11.6",
"bn.js": "^4.11.9"
},
"devDependencies": {
"@polkadot/keyring": "^6.0.1-5"
"@polkadot/keyring": "^6.0.1-9"
}
}