[ethereum/go-ethereum] les: implement ulc (#16904)

zsfelfoldi commented on this pull request.

> @@ -412,81 +456,133 @@ func (f *lightFetcher) nextRequest() (*distReq, uint64) {
— if bestTd == f.maxConfirmedTd {
— return nil, 0
+ return
+// findBestValuesForULC retrieves the best values for ULC mode.
+func (f *lightFetcher) findBestValuesForULC() (bestHash common.Hash, bestAmount uint64, bestTd *big.Int, bestSyncing bool) {

I don’t even think it is necessary to factor out this part from nextRequest. Finding the best hash to request is the main function of nextRequest and it is not all that different if you do it in ULC mode, it’s just an extra check. Putting it in an extra function IMHO does not improve readablility.
On the other hand, I do like factoring out newFetcherDistReqForSync and newFetcherDistReq, it makes the code easier to read.

Добавить комментарий