neoneo-go/pkg/network/payload
Anna Shaleva 9b364aa7ee network: do not allow to request invalid block count
The problem is in peer disconnection due to invalid GetBlockByIndex
payload (the logs are from some patched neo-go version):
```
дек 15 16:02:39 glagoli neo-go[928530]: 2022-12-15T16:02:39.490Z        INFO        new peer connected        {"addr": "10.78.69.115:50846", "peerCount": 3}
дек 15 16:02:39 glagoli neo-go[928530]: 2022-12-15T16:02:39.490Z        WARN        peer disconnected        {"addr": "10.78.69.115:50846", "error": "invalid block count", "peerCount": 2}
дек 15 16:02:39 glagoli neo-go[928530]: 2022-12-15T16:02:39.490Z        INFO        started protocol        {"addr": "10.78.69.115:50846", "userAgent": "/NEO-GO:1.0.0/", "startHeight": 0, "id": 1339571820}
дек 15 16:02:39 glagoli neo-go[928530]: 2022-12-15T16:02:39.491Z        INFO        new peer connected        {"addr": "10.78.69.115:50856", "peerCount": 3}
дек 15 16:02:39 glagoli neo-go[928530]: 2022-12-15T16:02:39.492Z        WARN        peer disconnected        {"addr": "10.78.69.115:50856", "error": "invalid block count", "peerCount": 2}
дек 15 16:02:39 glagoli neo-go[928530]: 2022-12-15T16:02:39.492Z        INFO        started protocol        {"addr": "10.78.69.115:50856", "userAgent": "/NEO-GO:1.0.0/", "startHeight": 0, "id": 1339571820}
дек 15 16:02:39 glagoli neo-go[928530]: 2022-12-15T16:02:39.492Z        INFO        new peer connected        {"addr": "10.78.69.115:50858", "peerCount": 3}
дек 15 16:02:39 glagoli neo-go[928530]: 2022-12-15T16:02:39.493Z        INFO        started protocol        {"addr": "10.78.69.115:50858", "userAgent": "/NEO-GO:1.0.0/", "startHeight": 0, "id": 1339571820}
дек 15 16:02:39 glagoli neo-go[928530]: 2022-12-15T16:02:39.493Z        WARN        peer disconnected        {"addr": "10.78.69.115:50858", "error": "invalid block count", "peerCount": 2}
дек 15 16:02:39 glagoli neo-go[928530]: 2022-12-15T16:02:39.494Z        INFO        new peer connected        {"addr": "10.78.69.115:50874", "peerCount": 3}
дек 15 16:02:39 glagoli neo-go[928530]: 2022-12-15T16:02:39.494Z        INFO        started protocol        {"addr": "10.78.69.115:50874", "userAgent": "/NEO-GO:1.0.0/", "startHeight": 0, "id": 1339571820}
дек 15 16:02:39 glagoli neo-go[928530]: 2022-12-15T16:02:39.494Z        WARN        peer disconnected        {"addr": "10.78.69.115:50874", "error": "invalid block count", "peerCount": 2}
```

GetBlockByIndex payload can't be decoded, and the only possible cause
is zero (or <-1, but it's probably not the case) block count requested.

Error is improved as far.
2022-12-28 13:04:56 +03:00
..
address.go [#2442] English Check 2022-05-04 19:48:27 +03:00
address_test.go *: use localhost address instead of 127.0.0.1, fix #2575 2022-06-30 16:19:07 +03:00
extensible.go network/consensus: always process dBFT messages as high priority 2022-08-02 13:07:18 +03:00
extensible_test.go payload: drop Network from Extensible 2021-03-26 13:45:18 +03:00
getblockbyindex.go network: do not allow to request invalid block count 2022-12-28 13:04:56 +03:00
getblockbyindex_test.go pkg: move internal/ package to the root directory 2020-11-24 16:39:56 +03:00
getblocks.go [#2442] English Check 2022-05-04 19:48:27 +03:00
getblocks_test.go pkg: move internal/ package to the root directory 2020-11-24 16:39:56 +03:00
headers.go [#2442] English Check 2022-05-04 19:48:27 +03:00
headers_test.go block: replace Base with Header 2021-03-10 13:38:44 +03:00
inventory.go [#2442] English Check 2022-05-04 19:48:27 +03:00
inventory_test.go network: replace ConsensusType with ExtensibleType 2021-01-22 10:38:33 +03:00
merkleblock.go [#2442] English Check 2022-05-04 19:48:27 +03:00
merkleblock_test.go block: replace Base with Header 2021-03-10 13:38:44 +03:00
mptdata.go [#2442] English Check 2022-05-04 19:48:27 +03:00
mptdata_test.go core: implement statesync module 2021-09-07 19:43:27 +03:00
mptinventory.go [#2442] English Check 2022-05-04 19:48:27 +03:00
mptinventory_test.go core: implement statesync module 2021-09-07 19:43:27 +03:00
notary_request.go *: use uint*Size and SignatureLen constants where appropriate 2022-10-05 10:45:52 +03:00
notary_request_test.go *: use uint*Size and SignatureLen constants where appropriate 2022-10-05 10:45:52 +03:00
payload.go [#2442] English Check 2022-05-04 19:48:27 +03:00
ping.go [#2442] English Check 2022-05-04 19:48:27 +03:00
ping_test.go pkg: move internal/ package to the root directory 2020-11-24 16:39:56 +03:00
version.go [#2442] English Check 2022-05-04 19:48:27 +03:00
version_test.go pkg: move internal/ package to the root directory 2020-11-24 16:39:56 +03:00