Snapshot sync and block gap info in eth_syncing (#2948)

* provide snapshot sync info in eth_syncing

* specify block gap in eth_syncing

* Extend eth_syncing with warp, format the output properly

* adjust serialization tests for sync info

* whitespace
This commit is contained in:
Robert Habermeier
2016-10-31 17:32:53 +01:00
committed by Gav Wood
parent ff90fac125
commit 8599a11a0b
13 changed files with 220 additions and 23 deletions

View File

@@ -153,6 +153,28 @@ export function outSignerRequest (request) {
return request;
}
export function outSyncing (syncing) {
if (syncing && syncing !== 'false') {
Object.keys(syncing).forEach((key) => {
switch (key) {
case 'currentBlock':
case 'highestBlock':
case 'startingBlock':
case 'warpChunksAmount':
case 'warpChunksProcessed':
syncing[key] = outNumber(syncing[key]);
break;
case 'blockGap':
syncing[key] = syncing[key].map(outNumber);
break;
}
});
}
return syncing;
}
export function outTransaction (tx) {
if (tx) {
Object.keys(tx).forEach((key) => {