Anton Kaliaev
0a7b2ab52c
fix invalid memory address or nil pointer dereference error (Refs #762 )
https://github.com/tendermint/tendermint/issues/762#issuecomment-338276055
```
E[10-19|04:52:38.969] Stopping peer for error module=p2p peer="Peer{MConn{178.62.46.14:46656} B14916FAF38A out}" err="Error: runtime error: invalid memory address or nil pointer dereference\nStack: goroutine 529485 [running]:\nruntime/debug.Stack(0xc4355cfb38, 0xb463e0, 0x11b1c30)\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0xa7\ngithub.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/p2p.(*MConnection)._recover(0xc439a28870)\n\t/home/ubuntu/go/src/github.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/p2p/connection.go:206 +0x6e\npanic(0xb463e0, 0x11b1c30)\n\t/usr/local/go/src/runtime/panic.go:491 +0x283\ngithub.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/blockchain.(*bpPeer).decrPending(0x0, 0x381)\n\t/home/ubuntu/go/src/github.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/blockchain/pool.go:376 +0x22\ngithub.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/blockchain.(*BlockPool).AddBlock(0xc4200e4000, 0xc4266d1f00, 0x40, 0xc432ac9640, 0x381)\n\t/home/ubuntu/go/src/github.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/blockchain/pool.go:215 +0x139\ngithub.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/blockchain.(*BlockchainReactor).Receive(0xc42050a780, 0xc420257740, 0x1171be0, 0xc42ff302d0, 0xc4384b2000, 0x381, 0x1000)\n\t/home/ubuntu/go/src/github.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/blockchain/reactor.go:160 +0x712\ngithub.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/p2p.createMConnection.func1(0x11e5040, 0xc4384b2000, 0x381, 0x1000)\n\t/home/ubuntu/go/src/github.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/p2p/peer.go:334 +0xbd\ngithub.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/p2p.(*MConnection).recvRoutine(0xc439a28870)\n\t/home/ubuntu/go/src/github.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/p2p/connection.go:475 +0x4a3\ncreated by github.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/p2p.(*MConnection).OnStart\n\t/home/ubuntu/go/src/github.com/cosmos/gaia/vendor/github.com/tendermint/tendermint/p2p/connection.go:170 +0x187\n"
```
7 years ago
Anton Kaliaev
d6a87d3c43
[rpc] DumpConsensusState: output state as json rather than string
Before:
```
{
"jsonrpc": "2.0",
"id": "",
"result": {
"round_state": "RoundState{\n H:10 R:0 S:RoundStepNewHeight\n StartTime: 2017-10-09 13:07:24.841134374 +0400 +04\n CommitTime: 2017-10-09 13:07:23.841134374 +0400 +04\n Validators: ValidatorSet{\n Proposer: Validator{EF243CC0E9B88D0161D24D733BDE9003518CEA27 {PubKeyEd25519{2E0B9301334FCDAB193D514022F81BA09BBEC028685C96602BE9DD0BD4F9E202}} VP:10 A:0}\n Validators:\n Validator{EF243CC0E9B88D0161D24D733BDE9003518CEA27 {PubKeyEd25519{2E0B9301334FCDAB193D514022F81BA09BBEC028685C96602BE9DD0BD4F9E202}} VP:10 A:0}\n }\n Proposal: \u003cnil\u003e\n ProposalBlock: nil-PartSet nil-Block\n LockedRound: 0\n LockedBlock: nil-PartSet nil-Block\n Votes: HeightVoteSet{H:10 R:0~0\n VoteSet{H:10 R:0 T:1 +2/3:\u003cnil\u003e BA{1:_} map[]}\n VoteSet{H:10 R:0 T:2 +2/3:\u003cnil\u003e BA{1:_} map[]}\n }\n LastCommit: VoteSet{H:9 R:0 T:2 +2/3:947F67A7B85439AF2CD5DFED376C51AC7BD67AEE:1:365E9983E466 BA{1:X} map[]}\n LastValidators: ValidatorSet{\n Proposer: Validator{EF243CC0E9B88D0161D24D733BDE9003518CEA27 {PubKeyEd25519{2E0B9301334FCDAB193D514022F81BA09BBEC028685C96602BE9DD0BD4F9E202}} VP:10 A:0}\n Validators:\n Validator{EF243CC0E9B88D0161D24D733BDE9003518CEA27 {PubKeyEd25519{2E0B9301334FCDAB193D514022F81BA09BBEC028685C96602BE9DD0BD4F9E202}} VP:10 A:0}\n }\n}",
"peer_round_states": []
}
}
```
After:
```
{
"jsonrpc": "2.0",
"id": "",
"result": {
"round_state": {
"Height": 1691,
"Round": 0,
"Step": 1,
"StartTime": "2017-10-09T14:08:09.129491764+04:00",
"CommitTime": "2017-10-09T14:08:08.129491764+04:00",
"Validators": {
"validators": [
{
"address": "EF243CC0E9B88D0161D24D733BDE9003518CEA27",
"pub_key": {
"type": "ed25519",
"data": "2E0B9301334FCDAB193D514022F81BA09BBEC028685C96602BE9DD0BD4F9E202"
},
"voting_power": 10,
"accum": 0
}
],
"proposer": {
"address": "EF243CC0E9B88D0161D24D733BDE9003518CEA27",
"pub_key": {
"type": "ed25519",
"data": "2E0B9301334FCDAB193D514022F81BA09BBEC028685C96602BE9DD0BD4F9E202"
},
"voting_power": 10,
"accum": 0
}
},
"Proposal": null,
"ProposalBlock": null,
"ProposalBlockParts": null,
"LockedRound": 0,
"LockedBlock": null,
"LockedBlockParts": null,
"Votes": {},
"CommitRound": -1,
"LastCommit": {},
"LastValidators": {
"validators": [
{
"address": "EF243CC0E9B88D0161D24D733BDE9003518CEA27",
"pub_key": {
"type": "ed25519",
"data": "2E0B9301334FCDAB193D514022F81BA09BBEC028685C96602BE9DD0BD4F9E202"
},
"voting_power": 10,
"accum": 0
}
],
"proposer": {
"address": "EF243CC0E9B88D0161D24D733BDE9003518CEA27",
"pub_key": {
"type": "ed25519",
"data": "2E0B9301334FCDAB193D514022F81BA09BBEC028685C96602BE9DD0BD4F9E202"
},
"voting_power": 10,
"accum": 0
}
}
},
"peer_round_states": {
"75EC8F15D244A421202F9725CD4DE509EE50303670310CF7530EF25E2B7C524B": {
"Height": 1691,
"Round": 0,
"Step": 1,
"StartTime": "2017-10-09T14:08:08.563251997+04:00",
"Proposal": false,
"ProposalBlockPartsHeader": {
"total": 0,
"hash": ""
},
"ProposalBlockParts": null,
"ProposalPOLRound": -1,
"ProposalPOL": null,
"Prevotes": null,
"Precommits": null,
"LastCommitRound": 0,
"LastCommit": null,
"CatchupCommitRound": -1,
"CatchupCommit": null
}
}
}
}
```
7 years ago