Skip to content

Commit 1cec91b

Browse files
committed
fix: check the error message instead of skip the first tx
1 parent dabc56f commit 1cec91b

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

node/remote/node.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,12 @@ func (cp *Node) Tx(hash string) (*types.Tx, error) {
259259

260260
res, err := cp.txServiceClient.GetTx(context.Background(), &tx.GetTxRequest{Hash: hash}, grpc.MaxCallRecvMsgSize(13107200))
261261
if err != nil {
262+
if cp.ignoreConnectVoteExtensionTx {
263+
// ignore the oracle vote extension tx
264+
if strings.Contains(err.Error(), "expected 2 wire type, got 0") {
265+
return nil, nil
266+
}
267+
}
262268
return nil, err
263269
}
264270

@@ -273,18 +279,17 @@ func (cp *Node) Tx(hash string) (*types.Tx, error) {
273279
// Txs implements node.Node
274280

275281
func (cp *Node) Txs(block *tmctypes.ResultBlock) ([]*types.Tx, error) {
276-
txs := block.Block.Txs
277-
if cp.ignoreConnectVoteExtensionTx && len(block.Block.Txs) > 0 {
278-
txs = block.Block.Txs[1:]
279-
}
280-
txResponses := make([]*types.Tx, len(txs))
281-
for i, tmTx := range txs {
282+
var txResponses []*types.Tx
283+
for _, tmTx := range block.Block.Txs {
282284
txResponse, err := cp.Tx(fmt.Sprintf("%X", cp.computeTxHash(tmTx)))
283285
if err != nil {
284286
return nil, err
285287
}
288+
if txResponse == nil {
289+
continue
290+
}
286291

287-
txResponses[i] = txResponse
292+
txResponses = append(txResponses, txResponse)
288293
}
289294

290295
return txResponses, nil

0 commit comments

Comments
 (0)