neoneo-go/pkg/consensus
Anna Shaleva 995abcf0c3 consensus: prevent invalid message panic
After 5c2f69bd2c there's an `invalid
message` panic when trying to run 4-nodes private network:

```
=> Try to restore blocks before running node
2020-06-30T08:59:39.696Z	INFO	no storage version found! creating genesis block
2020-06-30T08:59:39.696Z	INFO	service is running	{"service": "Prometheus", "endpoint": ":20001"}
2020-06-30T08:59:39.696Z	INFO	service hasn't started since it's disabled	{"service": "Pprof"}

    _   ____________        __________
   / | / / ____/ __ \      / ____/ __ \
  /  |/ / __/ / / / /_____/ / __/ / / /
 / /|  / /___/ /_/ /_____/ /_/ / /_/ /
/_/ |_/_____/\____/      \____/\____/
2020-06-30T08:59:39.696Z	INFO	starting rpc-server	{"endpoint": ":30333"}
2020-06-30T08:59:39.696Z	INFO	node started	{"blockHeight": 0, "headerHeight": 0}

/NEO-GO:/

2020-06-30T08:59:39.697Z	INFO	new peer connected	{"addr": "172.200.0.1:20333", "peerCount": 1}
2020-06-30T08:59:39.697Z	INFO	new peer connected	{"addr": "172.200.0.2:46692", "peerCount": 2}
2020-06-30T08:59:39.697Z	INFO	new peer connected	{"addr": "172.200.0.1:54140", "peerCount": 3}
2020-06-30T08:59:39.697Z	INFO	new peer connected	{"addr": "172.200.0.4:42890", "peerCount": 4}
2020-06-30T08:59:39.697Z	INFO	new peer connected	{"addr": "172.200.0.4:20336", "peerCount": 5}
2020-06-30T08:59:39.697Z	INFO	new peer connected	{"addr": "172.200.0.2:20334", "peerCount": 6}
2020-06-30T08:59:39.697Z	INFO	started protocol	{"addr": "172.200.0.4:42890", "userAgent": "/NEO-GO:/", "startHeight": 0, "id": 3797159912}
2020-06-30T08:59:39.697Z	WARN	peer disconnected	{"addr": "172.200.0.4:20336", "reason": "already connected", "peerCount": 5}
2020-06-30T08:59:39.697Z	INFO	started protocol	{"addr": "172.200.0.2:20334", "userAgent": "/NEO-GO:/", "startHeight": 0, "id": 1116452361}
2020-06-30T08:59:39.697Z	WARN	peer disconnected	{"addr": "172.200.0.2:46692", "reason": "already connected", "peerCount": 4}
2020-06-30T08:59:39.697Z	WARN	peer disconnected	{"addr": "172.200.0.1:54140", "reason": "identical node id", "peerCount": 3}
2020-06-30T08:59:39.697Z	WARN	peer disconnected	{"addr": "172.200.0.1:20333", "reason": "identical node id", "peerCount": 2}
2020-06-30T08:59:40.673Z	INFO	new peer connected	{"addr": "172.200.0.3:44948", "peerCount": 3}
2020-06-30T08:59:40.673Z	INFO	new peer connected	{"addr": "172.200.0.3:20335", "peerCount": 4}
2020-06-30T08:59:40.673Z	WARN	peer disconnected	{"addr": "172.200.0.3:20335", "reason": "already connected", "peerCount": 3}
2020-06-30T08:59:40.673Z	WARN	peer disconnected	{"addr": "172.200.0.3:44948", "reason": "unexpected empty payload", "peerCount": 2}
2020-06-30T08:59:40.673Z	INFO	new peer connected	{"addr": "172.200.0.3:44950", "peerCount": 3}
2020-06-30T08:59:40.673Z	INFO	new peer connected	{"addr": "172.200.0.3:20335", "peerCount": 4}
2020-06-30T08:59:40.677Z	INFO	node reached synchronized state, starting consensus
2020-06-30T08:59:40.677Z	INFO	started protocol	{"addr": "172.200.0.3:44950", "userAgent": "/NEO-GO:/", "startHeight": 0, "id": 2658713129}
2020-06-30T08:59:40.689Z	WARN	peer disconnected	{"addr": "172.200.0.3:20335", "reason": "already connected", "peerCount": 3}
2020-06-30T08:59:40.697Z	INFO	blockchain persist completed	{"persistedBlocks": 0, "persistedKeys": 23, "headerHeight": 0, "blockHeight": 0, "took": "243.634µs"}
2020-06-30T08:59:41.057Z	INFO	initializing dbft	{"height": 1, "view": 0, "index": 0, "role": "Backup"}
2020-06-30T08:59:41.057Z	DPANIC	invalid message
2020-06-30T08:59:41.058Z	DPANIC	invalid message
```

Reason: payload wasn't decoded as payload.message isn't null anymore.
Fixed.
2020-06-30 12:06:50 +03:00
..
testdata *: change address to the new format 2020-06-17 15:58:21 +03:00
block.go consensus.Block: removed unnecessary setters 2020-04-27 17:59:56 +03:00
block_test.go block/transaction: add network magic into the hash 2020-06-18 12:39:50 +03:00
cache.go *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
cache_test.go consensus: added partial message decoding 2020-04-16 14:35:58 +03:00
change_view.go *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
change_view_test.go network: plug in dBFT library 2019-11-27 10:57:22 +03:00
commit.go *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
commit_test.go random: make use or random package in tests 2020-03-27 10:27:46 +03:00
consensus.go consensus: prevent invalid message panic 2020-06-30 12:06:50 +03:00
consensus_test.go Merge pull request #1132 from nspcc-dev/neo3/rpc/fixed8_marshalling 2020-06-29 21:44:40 +03:00
crypto.go *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
crypto_test.go *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
payload.go consensus: take payload hash based on data 2020-06-29 15:52:06 +03:00
payload_test.go consensus: add network magic to hash data 2020-06-26 18:41:04 +03:00
prepare_request.go *: drop miner transaction 2020-04-27 17:57:37 +03:00
prepare_request_test.go core, consensus: nanoseconds-precision timestamp 2020-04-27 17:57:32 +03:00
prepare_response.go *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
prepare_response_test.go *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
recovery_message.go consensus: restrict invocation script size 2020-06-27 12:18:12 +03:00
recovery_message_test.go *: drop miner transaction 2020-04-27 17:57:37 +03:00
recovery_request.go *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
recovery_request_test.go network: plug in dBFT library 2019-11-27 10:57:22 +03:00