diff options
author | Sonic <sonic@dexon.org> | 2019-03-27 14:23:19 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-13 18:11:44 +0800 |
commit | 9d098bb29764280ad6799a2ab44ecdd3e28fa2ed (patch) | |
tree | db4aca17d7c9beec5c2fcfd71a0c76525663f218 /dex/handler.go | |
parent | 0e51a6d76ea35124af30fc81017ea8ac3775c54c (diff) | |
download | go-tangerine-9d098bb29764280ad6799a2ab44ecdd3e28fa2ed.tar.gz go-tangerine-9d098bb29764280ad6799a2ab44ecdd3e28fa2ed.tar.zst go-tangerine-9d098bb29764280ad6799a2ab44ecdd3e28fa2ed.zip |
dex: fix missing trie node when fast syncing (#301)
* dex: don't panic when we don't have gov state peer requested
* dex: use correct head block
Since we are fast syncing, we probably don't have body, receipt, state
Diffstat (limited to 'dex/handler.go')
-rw-r--r-- | dex/handler.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/dex/handler.go b/dex/handler.go index 84170e54b..ec5704103 100644 --- a/dex/handler.go +++ b/dex/handler.go @@ -361,7 +361,7 @@ func (pm *ProtocolManager) handle(p *peer) error { // Execute the Ethereum handshake var ( genesis = pm.blockchain.Genesis() - head = pm.blockchain.CurrentHeader() + head = pm.blockchain.CurrentBlock().Header() hash = head.Hash() number = head.Number.Uint64() ) @@ -953,7 +953,8 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { } govState, err := pm.blockchain.GetGovStateByHash(hash) if err != nil { - panic(err) + p.Log().Debug("Invalid gov state msg", "hash", hash.String(), "err", err) + return errResp(ErrInvalidGovStateMsg, "hash=%v", hash.String()) } return p.SendGovState(govState) case msg.Code == GovStateMsg: |