Skip to content

Commit

Permalink
check if deliverTxResCh is still open, return an err otherwise
Browse files Browse the repository at this point in the history
Fixes #2408
  • Loading branch information
melekes committed Nov 29, 2018
1 parent 44b769b commit c85b5d7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rpc/core/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@ func BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
// TODO: configurable?
var deliverTxTimeout = rpcserver.WriteTimeout / 2
select {
case deliverTxResMsg := <-deliverTxResCh: // The tx was included in a block.
case deliverTxResMsg, ok := <-deliverTxResCh: // The tx was included in a block.
if !ok {
return nil, errors.New("Error on broadcastTxCommit: expected DeliverTxResult, got nil. Did the Tendermint stop?")
}
deliverTxRes := deliverTxResMsg.(types.EventDataTx)
return &ctypes.ResultBroadcastTxCommit{
CheckTx: *checkTxRes,
Expand Down

0 comments on commit c85b5d7

Please sign in to comment.