eth: request id dispatcher and direct req/reply APIs (#23576)

* eth: request ID based message dispatcher

* eth: fix dispatcher cancellation, rework fetchers idleness tracker

* eth/downloader: drop peers who refuse to serve advertised chains
This commit is contained in:
Péter Szilágyi
2021-11-26 13:26:03 +02:00
committed by GitHub
parent 3038e480f5
commit c10a0a62c3
52 changed files with 3213 additions and 3400 deletions

View File

@ -131,11 +131,21 @@ func (s *PublicEthereumAPI) Syncing() (interface{}, error) {
}
// Otherwise gather the block sync stats
return map[string]interface{}{
"startingBlock": hexutil.Uint64(progress.StartingBlock),
"currentBlock": hexutil.Uint64(progress.CurrentBlock),
"highestBlock": hexutil.Uint64(progress.HighestBlock),
"pulledStates": hexutil.Uint64(progress.PulledStates),
"knownStates": hexutil.Uint64(progress.KnownStates),
"startingBlock": hexutil.Uint64(progress.StartingBlock),
"currentBlock": hexutil.Uint64(progress.CurrentBlock),
"highestBlock": hexutil.Uint64(progress.HighestBlock),
"syncedAccounts": hexutil.Uint64(progress.SyncedAccounts),
"syncedAccountBytes": hexutil.Uint64(progress.SyncedAccountBytes),
"syncedBytecodes": hexutil.Uint64(progress.SyncedBytecodes),
"syncedBytecodeBytes": hexutil.Uint64(progress.SyncedBytecodeBytes),
"syncedStorage": hexutil.Uint64(progress.SyncedStorage),
"syncedStorageBytes": hexutil.Uint64(progress.SyncedStorageBytes),
"healedTrienodes": hexutil.Uint64(progress.HealedTrienodes),
"healedTrienodeBytes": hexutil.Uint64(progress.HealedTrienodeBytes),
"healedBytecodes": hexutil.Uint64(progress.HealedBytecodes),
"healedBytecodeBytes": hexutil.Uint64(progress.HealedBytecodeBytes),
"healingTrienodes": hexutil.Uint64(progress.HealingTrienodes),
"healingBytecode": hexutil.Uint64(progress.HealingBytecode),
}, nil
}

File diff suppressed because one or more lines are too long

View File

@ -3949,10 +3949,18 @@ var outputSyncingFormatter = function(result) {
result.startingBlock = utils.toDecimal(result.startingBlock);
result.currentBlock = utils.toDecimal(result.currentBlock);
result.highestBlock = utils.toDecimal(result.highestBlock);
if (result.knownStates) {
result.knownStates = utils.toDecimal(result.knownStates);
result.pulledStates = utils.toDecimal(result.pulledStates);
}
result.syncedAccounts = utils.toDecimal(result.syncedAccounts);
result.syncedAccountBytes = utils.toDecimal(result.syncedAccountBytes);
result.syncedBytecodes = utils.toDecimal(result.syncedBytecodes);
result.syncedBytecodeBytes = utils.toDecimal(result.syncedBytecodeBytes);
result.syncedStorage = utils.toDecimal(result.syncedStorage);
result.syncedStorageBytes = utils.toDecimal(result.syncedStorageBytes);
result.healedTrienodes = utils.toDecimal(result.healedTrienodes);
result.healedTrienodeBytes = utils.toDecimal(result.healedTrienodeBytes);
result.healedBytecodes = utils.toDecimal(result.healedBytecodes);
result.healedBytecodeBytes = utils.toDecimal(result.healedBytecodeBytes);
result.healingTrienodes = utils.toDecimal(result.healingTrienodes);
result.healingBytecode = utils.toDecimal(result.healingBytecode);
return result;
};