Skip to content

Commit

Permalink
(fix) Refactor elseIf chains
Browse files Browse the repository at this point in the history
  • Loading branch information
shibaeff committed Oct 2, 2024
1 parent b077d21 commit b7a87c3
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions client/chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -845,11 +845,13 @@ func (c *chainClient) SyncBroadcastSignedTx(txBytes []byte) (*txtypes.BroadcastT
if errRes := client.CheckCometError(err, txBytes); errRes != nil {
return &txtypes.BroadcastTxResponse{TxResponse: errRes}, err
}
} else if resultTx.TxResult.Code != 0 {
}
if resultTx.TxResult.Code != 0 {
resResultTx := sdk.NewResponseResultTx(resultTx, res.TxResponse.Tx, res.TxResponse.Timestamp)
res = &txtypes.BroadcastTxResponse{TxResponse: resResultTx}
return res, errors.New(fmt.Sprintf("Failed with non-zero code %d", resultTx.TxResult.Code))
} else if resultTx.Height > 0 {
}
if resultTx.Height > 0 {
resResultTx := sdk.NewResponseResultTx(resultTx, res.TxResponse.Tx, res.TxResponse.Timestamp)
res = &txtypes.BroadcastTxResponse{TxResponse: resResultTx}
return res, err
Expand All @@ -873,11 +875,13 @@ func (c *chainClient) SyncBroadcastSignedTx(txBytes []byte) (*txtypes.BroadcastT
t.Reset(defaultBroadcastStatusPoll)
continue

} else if resultTx.TxResult.Code != 0 {
}
if resultTx.TxResult.Code != 0 {
resResultTx := sdk.NewResponseResultTx(resultTx, res.TxResponse.Tx, res.TxResponse.Timestamp)
res = &txtypes.BroadcastTxResponse{TxResponse: resResultTx}
return res, errors.New(fmt.Sprintf("Failed with non-zero code %d", resultTx.TxResult.Code))
} else if resultTx.Height > 0 {
}
if resultTx.Height > 0 {
resResultTx := sdk.NewResponseResultTx(resultTx, res.TxResponse.Tx, res.TxResponse.Timestamp)
res = &txtypes.BroadcastTxResponse{TxResponse: resResultTx}
return res, err
Expand Down Expand Up @@ -934,11 +938,13 @@ func (c *chainClient) broadcastTx(
if errRes := client.CheckCometError(err, txBytes); errRes != nil {
return &txtypes.BroadcastTxResponse{TxResponse: errRes}, err
}
} else if resultTx.TxResult.Code != 0 {
}
if resultTx.TxResult.Code != 0 {
resResultTx := sdk.NewResponseResultTx(resultTx, res.TxResponse.Tx, res.TxResponse.Timestamp)
res = &txtypes.BroadcastTxResponse{TxResponse: resResultTx}
return res, errors.New(fmt.Sprintf("Failed with non-zero code %d", resultTx.TxResult.Code))
} else if resultTx.Height > 0 {
}
if resultTx.Height > 0 {
resResultTx := sdk.NewResponseResultTx(resultTx, res.TxResponse.Tx, res.TxResponse.Timestamp)
res = &txtypes.BroadcastTxResponse{TxResponse: resResultTx}
return res, err
Expand All @@ -962,12 +968,14 @@ func (c *chainClient) broadcastTx(
t.Reset(defaultBroadcastStatusPoll)
continue

} else if resultTx.TxResult.Code != 0 {
}
if resultTx.TxResult.Code != 0 {
resResultTx := sdk.NewResponseResultTx(resultTx, res.TxResponse.Tx, res.TxResponse.Timestamp)
res = &txtypes.BroadcastTxResponse{TxResponse: resResultTx}
t.Stop()
return res, errors.New(fmt.Sprintf("Failed with non-zero code %d", resultTx.TxResult.Code))
} else if resultTx.Height > 0 {
}
if resultTx.Height > 0 {
resResultTx := sdk.NewResponseResultTx(resultTx, res.TxResponse.Tx, res.TxResponse.Timestamp)
res = &txtypes.BroadcastTxResponse{TxResponse: resResultTx}
t.Stop()
Expand Down

0 comments on commit b7a87c3

Please sign in to comment.