Be a nice neighbor, try to reply with whatever headers we have, don't fail
completely because of a single missing header.
Signed-off-by: Roman Khimov <roman@nspcc.ru>
Transfer data is timestamp-based, previously it always had and used headers,
no we can go via a small cache (we don't want it to grow or be stored forever).
Otherwise it's unable to do the job:
2024-12-13T12:55:15.056+0300 ERROR failed to find block header for transfer GC {"time": "19.066µs", "error": "key not found"}
Signed-off-by: Roman Khimov <roman@nspcc.ru>
It's there since 423c7883b8, but looks like it
never changed anything, the same thing is done six lines above and tgtBlock is
not changed since.
Signed-off-by: Roman Khimov <roman@nspcc.ru>
Fix linter after #3746 and #3747:
```
Running [/home/runner/golangci-lint-1.62.2-linux-amd64/golangci-lint run --path-prefix=scripts --config=/home/runner/work/neo-go/neo-go/nspcc-gh/.golangci.yml] in [/home/runner/work/neo-go/neo-go/scripts] ...
level=error msg="Running error: context loading failed: no go files to analyze: running `go mod tidy` may solve the problem"
Error: golangci-lint exit with code 5
```
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
It's important to have the same chain configuration for all tests.
Otherwise, a mismatched hardfork configuration is used to dump/restore
the basic chain.
Close#3681
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
Drain the channel only if it has pending events. This avoids trying to
read from an already-empty channel.
Close#3734
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
They will be returned to pool when disconnected anyway. On a smaller network
this can make a difference because there are not a lot of addresses in the
pool usually.
Signed-off-by: Roman Khimov <roman@nspcc.ru>
It's impossible to maintain a 4K line. I'm not even sure new table works good
enough, but at least it's per-hardfork.
Signed-off-by: Roman Khimov <roman@nspcc.ru>
Function doesn't make much sense here. The change is rather trivial and this
is not expected to be used by external code, so no deprecation.
Signed-off-by: Roman Khimov <roman@nspcc.ru>
Differentiate released and stable ones from test-only not-yet-ready and such.
Enabled only stable ones by default to avoid surprises in private networks
when some beta hardfork is made available with some node release.
Fixes#3719.
Signed-off-by: Roman Khimov <roman@nspcc.ru>
It's not supposed to happen, but if blockfetcher goes wild and calls this
twice it can ruin the system, so better safe than sorry.
Signed-off-by: Roman Khimov <roman@nspcc.ru>
blockFetcherFin is closed by the block fetcher, so it will forever return
something in this loop making it an infinite loop, creating useless load
and affecting normal node operation.
Signed-off-by: Roman Khimov <roman@nspcc.ru>
Consider 10-node network. FanOut is 6 for it. optimalN is 12. But it's a
10-node network, you can't have more than 9 peers there. So adjust the formula
for netSize-1.
Signed-off-by: Roman Khimov <roman@nspcc.ru>
We can have _a lot_ of these in the log, but the only reason they happen is
because we're trying to interpret length before checking for reader error,
CMDVersion is just 0.
Signed-off-by: Roman Khimov <roman@nspcc.ru>