neoneo-go/pkg/consensus
Anna Shaleva 4809cdf0b0 consensus: fix panic during verifyBlock
Issue: panic during mixed 4-nodes consensus setup:
```
2021-03-18T12:01:50.715Z	INFO	skip change view	{"nc": 0, "nf": 3}
2021-03-18T12:01:52.786Z	INFO	received ChangeView	{"validator": 0, "reason": "Timeout", "new view": 1}
2021-03-18T12:01:53.602Z	INFO	received ChangeView	{"validator": 2, "reason": "Timeout", "new view": 1}
2021-03-18T12:01:56.736Z	INFO	received ChangeView	{"validator": 1, "reason": "Timeout", "new view": 1}
2021-03-18T12:01:56.736Z	INFO	changing dbft view	{"height": 3, "view": 1, "index": 3, "role": "Backup"}
2021-03-18T12:02:01.758Z	INFO	received PrepareRequest	{"validator": 2, "tx": 0}
panic: interface conversion: block.Block is nil, not *consensus.neoBlock

goroutine 315 [running]:
github.com/nspcc-dev/neo-go/pkg/consensus.(*service).verifyBlock(0xc000419540, 0x0, 0x0, 0x4)
	github.com/nspcc-dev/neo-go/pkg/consensus/consensus.go:427 +0x1306
github.com/nspcc-dev/dbft.(*DBFT).createAndCheckBlock(0xc0001f8840, 0x13f0002)
	github.com/nspcc-dev/dbft@v0.0.0-20210302103605-cc75991b7cfb/dbft.go:373 +0x27e
github.com/nspcc-dev/dbft.(*DBFT).onPrepareRequest(0xc0001f8840, 0x13f4378, 0xc0003b8500)
	github.com/nspcc-dev/dbft@v0.0.0-20210302103605-cc75991b7cfb/dbft.go:329 +0xdf1
github.com/nspcc-dev/dbft.(*DBFT).OnReceive(0xc0001f8840, 0x13f4378, 0xc0003b8500)
	github.com/nspcc-dev/dbft@v0.0.0-20210302103605-cc75991b7cfb/dbft.go:247 +0xe25
github.com/nspcc-dev/neo-go/pkg/consensus.(*service).eventLoop(0xc000419540)
	github.com/nspcc-dev/neo-go/pkg/consensus/consensus.go:297 +0x79d
created by github.com/nspcc-dev/neo-go/pkg/consensus.(*service).Start
	github.com/nspcc-dev/neo-go/pkg/consensus/consensus.go:249 +0xa5
```

So (*service).verifyBlock is unable to work with nil block.
2021-03-18 18:20:33 +03:00
..
testdata core: refactor Neo.Crypto.CheckMultisigWithECDsaSecpr1 2021-03-10 21:46:05 +03:00
block.go block: replace Base with Header 2021-03-10 13:38:44 +03:00
block_test.go block: remove ConsensusData field 2021-03-10 13:38:44 +03:00
cache.go *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
cache_test.go consensus: refactor payloads structure 2021-01-22 10:38:32 +03:00
change_view.go consensus: replace magic 1000000 with something more meaningful 2020-07-11 19:54:50 +03:00
change_view_test.go consensus: replace magic 1000000 with something more meaningful 2020-07-11 19:54:50 +03:00
commit.go *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
commit_test.go pkg: move internal/ package to the root directory 2020-11-24 16:39:56 +03:00
consensus.go consensus: fix panic during verifyBlock 2021-03-18 18:20:33 +03:00
consensus_test.go config: add MaxBlockSystemFee setting 2021-03-16 12:09:11 +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: refactor payloads structure 2021-01-22 10:38:32 +03:00
payload_test.go *: upgrade tests to use T.Cleanup() 2021-03-01 17:08:00 +03:00
prepare_request.go consensus: refactor payloads structure 2021-01-22 10:38:32 +03:00
prepare_request_test.go pkg: move internal/ package to the root directory 2020-11-24 16:39:56 +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: refactor payloads structure 2021-01-22 10:38:32 +03:00
recovery_message_test.go *: upgrade tests to use T.Cleanup() 2021-03-01 17:08:00 +03:00
recovery_request.go consensus: replace magic 1000000 with something more meaningful 2020-07-11 19:54:50 +03:00
recovery_request_test.go consensus: replace magic 1000000 with something more meaningful 2020-07-11 19:54:50 +03:00