+4
-3
@@ -1,6 +1,7 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
@@ -90,7 +91,7 @@ func (ctx Context) BroadcastTxCommit(txBytes []byte) (*sdk.TxResponse, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res, err := node.BroadcastTxCommit(txBytes)
|
||||
res, err := node.BroadcastTxCommit(context.Background(), txBytes)
|
||||
if err != nil {
|
||||
if errRes := CheckTendermintError(err, txBytes); errRes != nil {
|
||||
return errRes, nil
|
||||
@@ -118,7 +119,7 @@ func (ctx Context) BroadcastTxSync(txBytes []byte) (*sdk.TxResponse, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res, err := node.BroadcastTxSync(txBytes)
|
||||
res, err := node.BroadcastTxSync(context.Background(), txBytes)
|
||||
if errRes := CheckTendermintError(err, txBytes); errRes != nil {
|
||||
return errRes, nil
|
||||
}
|
||||
@@ -134,7 +135,7 @@ func (ctx Context) BroadcastTxAsync(txBytes []byte) (*sdk.TxResponse, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res, err := node.BroadcastTxAsync(txBytes)
|
||||
res, err := node.BroadcastTxAsync(context.Background(), txBytes)
|
||||
if errRes := CheckTendermintError(err, txBytes); errRes != nil {
|
||||
return errRes, nil
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
@@ -20,15 +21,15 @@ type MockClient struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func (c MockClient) BroadcastTxCommit(tx tmtypes.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
|
||||
func (c MockClient) BroadcastTxCommit(ctx context.Context, tx tmtypes.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
|
||||
return nil, c.err
|
||||
}
|
||||
|
||||
func (c MockClient) BroadcastTxAsync(tx tmtypes.Tx) (*ctypes.ResultBroadcastTx, error) {
|
||||
func (c MockClient) BroadcastTxAsync(ctx context.Context, tx tmtypes.Tx) (*ctypes.ResultBroadcastTx, error) {
|
||||
return nil, c.err
|
||||
}
|
||||
|
||||
func (c MockClient) BroadcastTxSync(tx tmtypes.Tx) (*ctypes.ResultBroadcastTx, error) {
|
||||
func (c MockClient) BroadcastTxSync(ctx context.Context, tx tmtypes.Tx) (*ctypes.ResultBroadcastTx, error) {
|
||||
return nil, c.err
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
@@ -85,7 +86,7 @@ func (ctx Context) queryABCI(req abci.RequestQuery) (abci.ResponseQuery, error)
|
||||
Prove: req.Prove,
|
||||
}
|
||||
|
||||
result, err := node.ABCIQueryWithOptions(req.Path, req.Data, opts)
|
||||
result, err := node.ABCIQueryWithOptions(context.Background(), req.Path, req.Data, opts)
|
||||
if err != nil {
|
||||
return abci.ResponseQuery{}, err
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
@@ -62,7 +63,7 @@ func getBlock(clientCtx client.Context, height *int64) ([]byte, error) {
|
||||
// header -> BlockchainInfo
|
||||
// header, tx -> Block
|
||||
// results -> BlockResults
|
||||
res, err := node.Block(height)
|
||||
res, err := node.Block(context.Background(), height)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -77,7 +78,7 @@ func GetChainHeight(clientCtx client.Context) (int64, error) {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
status, err := node.Status()
|
||||
status, err := node.Status(context.Background())
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
@@ -51,7 +52,7 @@ func getNodeStatus(clientCtx client.Context) (*ctypes.ResultStatus, error) {
|
||||
return &ctypes.ResultStatus{}, err
|
||||
}
|
||||
|
||||
return node.Status()
|
||||
return node.Status(context.Background())
|
||||
}
|
||||
|
||||
// NodeInfoResponse defines a response type that contains node status and version
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
@@ -119,7 +120,7 @@ func GetValidators(clientCtx client.Context, height *int64, page, limit *int) (R
|
||||
return ResultValidatorsOutput{}, err
|
||||
}
|
||||
|
||||
validatorsRes, err := node.Validators(height, page, limit)
|
||||
validatorsRes, err := node.Validators(context.Background(), height, page, limit)
|
||||
if err != nil {
|
||||
return ResultValidatorsOutput{}, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user