docs: inline docs for batch call handler
This commit is contained in:
parent
92797c4ea5
commit
e597be41d5
@ -19,6 +19,7 @@ func batchCall() (bool, BatchResponse) {
|
|||||||
var batchResponse BatchResponse
|
var batchResponse BatchResponse
|
||||||
|
|
||||||
rpcResponses, err := RpcClient.EthBatchRpcCall(jsonrpc.RPCRequests{
|
rpcResponses, err := RpcClient.EthBatchRpcCall(jsonrpc.RPCRequests{
|
||||||
|
// The rpc call id here is guranteed to be in order of appearance starting from index 0
|
||||||
jsonrpc.NewRequest("eth_syncing"),
|
jsonrpc.NewRequest("eth_syncing"),
|
||||||
jsonrpc.NewRequest("parity_chain"),
|
jsonrpc.NewRequest("parity_chain"),
|
||||||
})
|
})
|
||||||
@ -31,11 +32,13 @@ func batchCall() (bool, BatchResponse) {
|
|||||||
return false, batchResponse
|
return false, batchResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Order and format isn't guranteed with batch calls therefore we individually process/transform each result in the map
|
||||||
if syncStatus, ok := rpcResponses[0]; ok {
|
if syncStatus, ok := rpcResponses[0]; ok {
|
||||||
val, err := syncStatus.GetBool()
|
val, err := syncStatus.GetBool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, batchResponse
|
return false, batchResponse
|
||||||
}
|
}
|
||||||
|
// If sync is complete the rpc result is false, however this call dones't gurantee all blocks have been imported
|
||||||
batchResponse.SyncComplete = !val
|
batchResponse.SyncComplete = !val
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user