go-ethereum/cmd
ozpool 80b58f649a
cmd/devp2p/internal/ethtest: fix header stride in reverse GetHeaders (#35362)
`Chain.GetHeaders` steps by `1 + Skip` in the forward branch but by `1 -
Skip` in the reverse branch. `Skip` is a `uint64`, so the reverse stride
is wrong for every `Skip > 0`:

| Skip | reverse step | result |
| --- | --- | --- |
| 0 | `-= 1` | correct |
| 1 | `-= 0` | block number never moves, the same header is returned
`Amount` times |
| >= 2 | `1 - Skip` underflows | walks *forward* instead of back (`Skip
= 2` on block 100 lands on 101) |

Per the `GetBlockHeadersRequest` definition, `Skip` is "Blocks to skip
between consecutive headers", so the stride is `Skip + 1` in whichever
direction the query runs. Subtracting `1 + Skip` makes the reverse
branch mirror the forward one.

The existing table test covers forward + `Skip: 1` and reverse + `Skip:
0` (which works by accident, since `1 - 0 == 1`). Added the missing
reverse + `Skip: 1` case; it fails on master:

```
--- FAIL: TestChainGetHeaders/3
    Test: TestChainGetHeaders/3
FAIL	github.com/ethereum/go-ethereum/cmd/devp2p/internal/ethtest
```

and passes with the fix (4/4).

No caller sends a reverse request with `Skip > 0` today, so nothing is
broken in the current suite. The helper computes the expected headers
that responses are checked against, though, so the moment a reverse+skip
case is added it would silently assert the wrong headers rather than
fail loudly.
2026-07-17 18:51:45 +02:00
..
abidump all: update license headers and AUTHORS from git history (#24947) 2022-05-24 20:39:40 +02:00
abigen cmd/abigen: respect --v2=false (#34943) 2026-05-12 09:02:40 -04:00
blsync beacon/blsync: add checkpoint import/export file feature (#31469) 2025-04-03 16:04:11 +02:00
devp2p cmd/devp2p/internal/ethtest: fix header stride in reverse GetHeaders (#35362) 2026-07-17 18:51:45 +02:00
era internal/era: update to latest ere spec (#34896) 2026-06-03 11:52:10 +02:00
ethkey cmd: fix some typos in readmes (#29405) 2024-04-11 14:06:49 +03:00
evm core: implement EIP-2780 and EIP-8037 changes (#35318) 2026-07-14 14:28:26 +02:00
fetchpayload cmd/fetchpayload: add payload-building utility (#33919) 2026-03-11 16:18:42 +01:00
geth core/txpool/blobpool, eth: implement sparse blobpool (#34047) 2026-07-15 14:41:04 +02:00
keeper go.mod: update ckzg (#35336) 2026-07-10 11:42:16 +02:00
rlpdump build: update to golangci-lint 1.61.0 (#30587) 2024-10-14 19:25:22 +02:00
utils core/txpool/blobpool, eth: implement sparse blobpool (#34047) 2026-07-15 14:41:04 +02:00
workload cmd/evm: respect --fuzz=false (#34975) 2026-07-06 12:36:29 +02:00