Skip to content

Commit 1f306b0

Browse files
committed
feat: ignore the first tx (connect oracle extension tx)
1 parent f171805 commit 1f306b0

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

node/remote/config.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@ import (
66

77
// Details represents a node details for a remote node
88
type Details struct {
9-
RPC *RPCConfig `yaml:"rpc"`
10-
GRPC *GRPCConfig `yaml:"grpc"`
9+
RPC *RPCConfig `yaml:"rpc"`
10+
GRPC *GRPCConfig `yaml:"grpc"`
11+
IgnoreConnectVoteExtensionTx bool `yaml:"ignore_connect_vote_extension_tx"` // ignore tx[0] for the chains that are using Skip Oracle
1112
}
1213

13-
func NewDetails(rpc *RPCConfig, grpc *GRPCConfig) *Details {
14+
func NewDetails(rpc *RPCConfig, grpc *GRPCConfig, ignoreConnectVoteExtensionTx bool) *Details {
1415
return &Details{
15-
RPC: rpc,
16-
GRPC: grpc,
16+
RPC: rpc,
17+
GRPC: grpc,
18+
IgnoreConnectVoteExtensionTx: ignoreConnectVoteExtensionTx,
1719
}
1820
}
1921

2022
func DefaultDetails() *Details {
21-
return NewDetails(DefaultRPCConfig(), DefaultGrpcConfig())
23+
return NewDetails(DefaultRPCConfig(), DefaultGrpcConfig(), false)
2224
}
2325

2426
// Validate implements node.Details

node/remote/node.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ type Node struct {
3636

3737
computeTxHash types.TxHashCalculator
3838

39-
client *httpclient.HTTP
40-
txServiceClient tx.ServiceClient
39+
client *httpclient.HTTP
40+
txServiceClient tx.ServiceClient
41+
ignoreConnectVoteExtensionTx bool
4142
}
4243

4344
// NewNode allows to build a new Node instance
@@ -74,8 +75,9 @@ func NewNode(
7475

7576
computeTxHash: txHashCalculator,
7677

77-
client: rpcClient,
78-
txServiceClient: tx.NewServiceClient(grpcConnection),
78+
client: rpcClient,
79+
txServiceClient: tx.NewServiceClient(grpcConnection),
80+
ignoreConnectVoteExtensionTx: cfg.IgnoreConnectVoteExtensionTx,
7981
}, nil
8082
}
8183

@@ -269,9 +271,14 @@ func (cp *Node) Tx(hash string) (*types.Tx, error) {
269271
}
270272

271273
// Txs implements node.Node
274+
272275
func (cp *Node) Txs(block *tmctypes.ResultBlock) ([]*types.Tx, error) {
273-
txResponses := make([]*types.Tx, len(block.Block.Txs))
274-
for i, tmTx := range block.Block.Txs {
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 {
275282
txResponse, err := cp.Tx(fmt.Sprintf("%X", cp.computeTxHash(tmTx)))
276283
if err != nil {
277284
return nil, err

0 commit comments

Comments
 (0)