check peerMempoolChan for nil on Reset

This commit is contained in:
Ethan Buchman
2015-10-19 12:34:53 -04:00
committed by Jae Kwon
parent 209bcf905e
commit df9ef1e733

View File

@@ -97,7 +97,12 @@ func (memR *MempoolReactor) Receive(chID byte, src *p2p.Peer, msgBytes []byte) {
func (memR *MempoolReactor) ResetForBlockAndState(block *types.Block, state *sm.State) {
ri := memR.Mempool.ResetForBlockAndState(block, state)
for _, peer := range memR.Switch.Peers().List() {
peerMempoolCh := peer.Data.Get(types.PeerMempoolChKey).(chan ResetInfo)
peerMempoolChI := peer.Data.Get(types.PeerMempoolChKey)
if peerMempoolChI == nil {
// peer was added to switch but not yet to the memR
continue
}
peerMempoolCh := peerMempoolChI.(chan ResetInfo)
select {
case peerMempoolCh <- ri:
default: