mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 14:52:17 +00:00
make govet linter pass (#3292)
* make govet linter pass Refs #3262 * close PipeReader and check for err
This commit is contained in:
parent
966b5bdf6e
commit
7fd51e6ade
@ -18,7 +18,6 @@ linters:
|
|||||||
- nakedret
|
- nakedret
|
||||||
- lll
|
- lll
|
||||||
- gochecknoglobals
|
- gochecknoglobals
|
||||||
- govet
|
|
||||||
- gocritic
|
- gocritic
|
||||||
- gosec
|
- gosec
|
||||||
- gochecknoinits
|
- gochecknoinits
|
||||||
|
@ -129,7 +129,7 @@ func (cli *grpcClient) EchoAsync(msg string) *ReqRes {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
cli.StopForError(err)
|
cli.StopForError(err)
|
||||||
}
|
}
|
||||||
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_Echo{res}})
|
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_Echo{Echo: res}})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *grpcClient) FlushAsync() *ReqRes {
|
func (cli *grpcClient) FlushAsync() *ReqRes {
|
||||||
@ -138,7 +138,7 @@ func (cli *grpcClient) FlushAsync() *ReqRes {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
cli.StopForError(err)
|
cli.StopForError(err)
|
||||||
}
|
}
|
||||||
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_Flush{res}})
|
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_Flush{Flush: res}})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *grpcClient) InfoAsync(params types.RequestInfo) *ReqRes {
|
func (cli *grpcClient) InfoAsync(params types.RequestInfo) *ReqRes {
|
||||||
@ -147,7 +147,7 @@ func (cli *grpcClient) InfoAsync(params types.RequestInfo) *ReqRes {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
cli.StopForError(err)
|
cli.StopForError(err)
|
||||||
}
|
}
|
||||||
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_Info{res}})
|
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_Info{Info: res}})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *grpcClient) SetOptionAsync(params types.RequestSetOption) *ReqRes {
|
func (cli *grpcClient) SetOptionAsync(params types.RequestSetOption) *ReqRes {
|
||||||
@ -156,7 +156,7 @@ func (cli *grpcClient) SetOptionAsync(params types.RequestSetOption) *ReqRes {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
cli.StopForError(err)
|
cli.StopForError(err)
|
||||||
}
|
}
|
||||||
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_SetOption{res}})
|
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_SetOption{SetOption: res}})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *grpcClient) DeliverTxAsync(tx []byte) *ReqRes {
|
func (cli *grpcClient) DeliverTxAsync(tx []byte) *ReqRes {
|
||||||
@ -165,7 +165,7 @@ func (cli *grpcClient) DeliverTxAsync(tx []byte) *ReqRes {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
cli.StopForError(err)
|
cli.StopForError(err)
|
||||||
}
|
}
|
||||||
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_DeliverTx{res}})
|
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_DeliverTx{DeliverTx: res}})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *grpcClient) CheckTxAsync(tx []byte) *ReqRes {
|
func (cli *grpcClient) CheckTxAsync(tx []byte) *ReqRes {
|
||||||
@ -174,7 +174,7 @@ func (cli *grpcClient) CheckTxAsync(tx []byte) *ReqRes {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
cli.StopForError(err)
|
cli.StopForError(err)
|
||||||
}
|
}
|
||||||
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_CheckTx{res}})
|
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_CheckTx{CheckTx: res}})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *grpcClient) QueryAsync(params types.RequestQuery) *ReqRes {
|
func (cli *grpcClient) QueryAsync(params types.RequestQuery) *ReqRes {
|
||||||
@ -183,7 +183,7 @@ func (cli *grpcClient) QueryAsync(params types.RequestQuery) *ReqRes {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
cli.StopForError(err)
|
cli.StopForError(err)
|
||||||
}
|
}
|
||||||
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_Query{res}})
|
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_Query{Query: res}})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *grpcClient) CommitAsync() *ReqRes {
|
func (cli *grpcClient) CommitAsync() *ReqRes {
|
||||||
@ -192,7 +192,7 @@ func (cli *grpcClient) CommitAsync() *ReqRes {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
cli.StopForError(err)
|
cli.StopForError(err)
|
||||||
}
|
}
|
||||||
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_Commit{res}})
|
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_Commit{Commit: res}})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *grpcClient) InitChainAsync(params types.RequestInitChain) *ReqRes {
|
func (cli *grpcClient) InitChainAsync(params types.RequestInitChain) *ReqRes {
|
||||||
@ -201,7 +201,7 @@ func (cli *grpcClient) InitChainAsync(params types.RequestInitChain) *ReqRes {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
cli.StopForError(err)
|
cli.StopForError(err)
|
||||||
}
|
}
|
||||||
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_InitChain{res}})
|
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_InitChain{InitChain: res}})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *grpcClient) BeginBlockAsync(params types.RequestBeginBlock) *ReqRes {
|
func (cli *grpcClient) BeginBlockAsync(params types.RequestBeginBlock) *ReqRes {
|
||||||
@ -210,7 +210,7 @@ func (cli *grpcClient) BeginBlockAsync(params types.RequestBeginBlock) *ReqRes {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
cli.StopForError(err)
|
cli.StopForError(err)
|
||||||
}
|
}
|
||||||
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_BeginBlock{res}})
|
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_BeginBlock{BeginBlock: res}})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *grpcClient) EndBlockAsync(params types.RequestEndBlock) *ReqRes {
|
func (cli *grpcClient) EndBlockAsync(params types.RequestEndBlock) *ReqRes {
|
||||||
@ -219,7 +219,7 @@ func (cli *grpcClient) EndBlockAsync(params types.RequestEndBlock) *ReqRes {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
cli.StopForError(err)
|
cli.StopForError(err)
|
||||||
}
|
}
|
||||||
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_EndBlock{res}})
|
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_EndBlock{EndBlock: res}})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cli *grpcClient) finishAsyncCall(req *types.Request, res *types.Response) *ReqRes {
|
func (cli *grpcClient) finishAsyncCall(req *types.Request, res *types.Response) *ReqRes {
|
||||||
|
@ -394,7 +394,6 @@ func cmdConsole(cmd *cobra.Command, args []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func muxOnCommands(cmd *cobra.Command, pArgs []string) error {
|
func muxOnCommands(cmd *cobra.Command, pArgs []string) error {
|
||||||
|
@ -302,7 +302,7 @@ FOR_LOOP:
|
|||||||
|
|
||||||
firstParts := first.MakePartSet(types.BlockPartSizeBytes)
|
firstParts := first.MakePartSet(types.BlockPartSizeBytes)
|
||||||
firstPartsHeader := firstParts.Header()
|
firstPartsHeader := firstParts.Header()
|
||||||
firstID := types.BlockID{first.Hash(), firstPartsHeader}
|
firstID := types.BlockID{Hash: first.Hash(), PartsHeader: firstPartsHeader}
|
||||||
// Finally, verify the first block using the second's commit
|
// Finally, verify the first block using the second's commit
|
||||||
// NOTE: we can probably make this more efficient, but note that calling
|
// NOTE: we can probably make this more efficient, but note that calling
|
||||||
// first.Hash() doesn't verify the tx contents, so MakePartSet() is
|
// first.Hash() doesn't verify the tx contents, so MakePartSet() is
|
||||||
|
@ -77,8 +77,6 @@ func NewRunNodeCmd(nodeProvider nm.NodeProvider) *cobra.Command {
|
|||||||
|
|
||||||
// Run forever
|
// Run forever
|
||||||
select {}
|
select {}
|
||||||
|
|
||||||
return nil
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -621,7 +621,6 @@ func getSwitchIndex(switches []*p2p.Switch, peer p2p.Peer) int {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
panic("didnt find peer in switches")
|
panic("didnt find peer in switches")
|
||||||
return -1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
@ -699,8 +698,7 @@ func (m *mockTicker) Chan() <-chan timeoutInfo {
|
|||||||
return m.c
|
return m.c
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mockTicker) SetLogger(log.Logger) {
|
func (*mockTicker) SetLogger(log.Logger) {}
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
|
|
||||||
|
@ -896,7 +896,7 @@ type PeerState struct {
|
|||||||
peer p2p.Peer
|
peer p2p.Peer
|
||||||
logger log.Logger
|
logger log.Logger
|
||||||
|
|
||||||
mtx sync.Mutex `json:"-"` // NOTE: Modify below using setters, never directly.
|
mtx sync.Mutex // NOTE: Modify below using setters, never directly.
|
||||||
PRS cstypes.PeerRoundState `json:"round_state"` // Exposed.
|
PRS cstypes.PeerRoundState `json:"round_state"` // Exposed.
|
||||||
Stats *peerStateStats `json:"stats"` // Exposed.
|
Stats *peerStateStats `json:"stats"` // Exposed.
|
||||||
}
|
}
|
||||||
|
@ -334,7 +334,7 @@ func (h *Handshaker) ReplayBlocks(
|
|||||||
|
|
||||||
} else if storeBlockHeight < appBlockHeight {
|
} else if storeBlockHeight < appBlockHeight {
|
||||||
// the app should never be ahead of the store (but this is under app's control)
|
// the app should never be ahead of the store (but this is under app's control)
|
||||||
return appHash, sm.ErrAppBlockHeightTooHigh{storeBlockHeight, appBlockHeight}
|
return appHash, sm.ErrAppBlockHeightTooHigh{CoreHeight: storeBlockHeight, AppHeight: appBlockHeight}
|
||||||
|
|
||||||
} else if storeBlockHeight < stateBlockHeight {
|
} else if storeBlockHeight < stateBlockHeight {
|
||||||
// the state should never be ahead of the store (this is under tendermint's control)
|
// the state should never be ahead of the store (this is under tendermint's control)
|
||||||
|
@ -103,7 +103,6 @@ func (cs *ConsensusState) ReplayFile(file string, console bool) error {
|
|||||||
}
|
}
|
||||||
pb.count++
|
pb.count++
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------
|
//------------------------------------------------
|
||||||
@ -295,7 +294,6 @@ func (pb *playback) replayConsoleLoop() int {
|
|||||||
fmt.Println(pb.count)
|
fmt.Println(pb.count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
|
@ -909,7 +909,7 @@ func (cs *ConsensusState) defaultDecideProposal(height int64, round int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make proposal
|
// Make proposal
|
||||||
propBlockId := types.BlockID{block.Hash(), blockParts.Header()}
|
propBlockId := types.BlockID{Hash: block.Hash(), PartsHeader: blockParts.Header()}
|
||||||
proposal := types.NewProposal(height, round, cs.ValidRound, propBlockId)
|
proposal := types.NewProposal(height, round, cs.ValidRound, propBlockId)
|
||||||
if err := cs.privValidator.SignProposal(cs.state.ChainID, proposal); err == nil {
|
if err := cs.privValidator.SignProposal(cs.state.ChainID, proposal); err == nil {
|
||||||
|
|
||||||
@ -1320,7 +1320,7 @@ func (cs *ConsensusState) finalizeCommit(height int64) {
|
|||||||
// Execute and commit the block, update and save the state, and update the mempool.
|
// Execute and commit the block, update and save the state, and update the mempool.
|
||||||
// NOTE The block.AppHash wont reflect these txs until the next block.
|
// NOTE The block.AppHash wont reflect these txs until the next block.
|
||||||
var err error
|
var err error
|
||||||
stateCopy, err = cs.blockExec.ApplyBlock(stateCopy, types.BlockID{block.Hash(), blockParts.Header()}, block)
|
stateCopy, err = cs.blockExec.ApplyBlock(stateCopy, types.BlockID{Hash: block.Hash(), PartsHeader: blockParts.Header()}, block)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cs.Logger.Error("Error on ApplyBlock. Did the application crash? Please restart tendermint", "err", err)
|
cs.Logger.Error("Error on ApplyBlock. Did the application crash? Please restart tendermint", "err", err)
|
||||||
err := cmn.Kill()
|
err := cmn.Kill()
|
||||||
@ -1543,7 +1543,7 @@ func (cs *ConsensusState) addVote(vote *types.Vote, peerID p2p.ID) (added bool,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cs.Logger.Info(fmt.Sprintf("Added to lastPrecommits: %v", cs.LastCommit.StringShort()))
|
cs.Logger.Info(fmt.Sprintf("Added to lastPrecommits: %v", cs.LastCommit.StringShort()))
|
||||||
cs.eventBus.PublishEventVote(types.EventDataVote{vote})
|
cs.eventBus.PublishEventVote(types.EventDataVote{Vote: vote})
|
||||||
cs.evsw.FireEvent(types.EventVote, vote)
|
cs.evsw.FireEvent(types.EventVote, vote)
|
||||||
|
|
||||||
// if we can skip timeoutCommit and have all the votes now,
|
// if we can skip timeoutCommit and have all the votes now,
|
||||||
@ -1571,7 +1571,7 @@ func (cs *ConsensusState) addVote(vote *types.Vote, peerID p2p.ID) (added bool,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
cs.eventBus.PublishEventVote(types.EventDataVote{vote})
|
cs.eventBus.PublishEventVote(types.EventDataVote{Vote: vote})
|
||||||
cs.evsw.FireEvent(types.EventVote, vote)
|
cs.evsw.FireEvent(types.EventVote, vote)
|
||||||
|
|
||||||
switch vote.Type {
|
switch vote.Type {
|
||||||
@ -1683,7 +1683,7 @@ func (cs *ConsensusState) signVote(type_ types.SignedMsgType, hash []byte, heade
|
|||||||
Round: cs.Round,
|
Round: cs.Round,
|
||||||
Timestamp: cs.voteTime(),
|
Timestamp: cs.voteTime(),
|
||||||
Type: type_,
|
Type: type_,
|
||||||
BlockID: types.BlockID{hash, header},
|
BlockID: types.BlockID{Hash: hash, PartsHeader: header},
|
||||||
}
|
}
|
||||||
err := cs.privValidator.SignVote(cs.state.ChainID, vote)
|
err := cs.privValidator.SignVote(cs.state.ChainID, vote)
|
||||||
return vote, err
|
return vote, err
|
||||||
|
@ -64,7 +64,6 @@ func makeVoteHR(t *testing.T, height int64, round int, privVals []types.PrivVali
|
|||||||
err := privVal.SignVote(chainID, vote)
|
err := privVal.SignVote(chainID, vote)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Sprintf("Error signing vote: %v", err))
|
panic(fmt.Sprintf("Error signing vote: %v", err))
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
return vote
|
return vote
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,8 @@ func checkAminoJSON(t *testing.T, src interface{}, dst interface{}, isNil bool)
|
|||||||
require.Nil(t, err, "%+v", err)
|
require.Nil(t, err, "%+v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ExamplePrintRegisteredTypes refers to unknown identifier: PrintRegisteredTypes
|
||||||
|
//nolint:govet
|
||||||
func ExamplePrintRegisteredTypes() {
|
func ExamplePrintRegisteredTypes() {
|
||||||
cdc.PrintTypes(os.Stdout)
|
cdc.PrintTypes(os.Stdout)
|
||||||
// Output: | Type | Name | Prefix | Length | Notes |
|
// Output: | Type | Name | Prefix | Length | Notes |
|
||||||
|
@ -52,8 +52,8 @@ func (pubKey PubKeySecp256k1) VerifyBytes(msg []byte, sigStr []byte) bool {
|
|||||||
// that len(sigStr) == 64.
|
// that len(sigStr) == 64.
|
||||||
func signatureFromBytes(sigStr []byte) *secp256k1.Signature {
|
func signatureFromBytes(sigStr []byte) *secp256k1.Signature {
|
||||||
return &secp256k1.Signature{
|
return &secp256k1.Signature{
|
||||||
new(big.Int).SetBytes(sigStr[:32]),
|
R: new(big.Int).SetBytes(sigStr[:32]),
|
||||||
new(big.Int).SetBytes(sigStr[32:64]),
|
S: new(big.Int).SetBytes(sigStr[32:64]),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,6 +412,6 @@ func (bA *BitArray) UnmarshalJSON(bz []byte) error {
|
|||||||
bA2.SetIndex(i, true)
|
bA2.SetIndex(i, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*bA = *bA2
|
*bA = *bA2 //nolint:govet
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -238,6 +238,10 @@ func TestSecretConnectionReadWrite(t *testing.T) {
|
|||||||
for {
|
for {
|
||||||
n, err := nodeSecretConn.Read(readBuffer)
|
n, err := nodeSecretConn.Read(readBuffer)
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
|
if err := nodeConn.PipeReader.Close(); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return nil, err, true
|
||||||
|
}
|
||||||
return nil, nil, false
|
return nil, nil, false
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
t.Errorf("Failed to read from nodeSecretConn: %v", err)
|
t.Errorf("Failed to read from nodeSecretConn: %v", err)
|
||||||
@ -245,11 +249,6 @@ func TestSecretConnectionReadWrite(t *testing.T) {
|
|||||||
}
|
}
|
||||||
*nodeReads = append(*nodeReads, string(readBuffer[:n]))
|
*nodeReads = append(*nodeReads, string(readBuffer[:n]))
|
||||||
}
|
}
|
||||||
if err := nodeConn.PipeReader.Close(); err != nil {
|
|
||||||
t.Error(err)
|
|
||||||
return nil, err, true
|
|
||||||
}
|
|
||||||
return nil, nil, false
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
assert.True(t, ok, "Unexpected task abortion")
|
assert.True(t, ok, "Unexpected task abortion")
|
||||||
|
@ -31,7 +31,6 @@ func voteToStep(vote *types.Vote) int8 {
|
|||||||
return stepPrecommit
|
return stepPrecommit
|
||||||
default:
|
default:
|
||||||
panic("Unknown vote type")
|
panic("Unknown vote type")
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ func DialTCPFn(addr string, connTimeout time.Duration, privKey ed25519.PrivKeyEd
|
|||||||
// DialUnixFn dials the given unix socket.
|
// DialUnixFn dials the given unix socket.
|
||||||
func DialUnixFn(addr string) Dialer {
|
func DialUnixFn(addr string) Dialer {
|
||||||
return func() (net.Conn, error) {
|
return func() (net.Conn, error) {
|
||||||
unixAddr := &net.UnixAddr{addr, "unix"}
|
unixAddr := &net.UnixAddr{Name: addr, Net: "unix"}
|
||||||
return net.DialUnix("unix", nil, unixAddr)
|
return net.DialUnix("unix", nil, unixAddr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (a ABCIApp) ABCIInfo() (*ctypes.ResultABCIInfo, error) {
|
func (a ABCIApp) ABCIInfo() (*ctypes.ResultABCIInfo, error) {
|
||||||
return &ctypes.ResultABCIInfo{a.App.Info(proxy.RequestInfo)}, nil
|
return &ctypes.ResultABCIInfo{Response: a.App.Info(proxy.RequestInfo)}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a ABCIApp) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error) {
|
func (a ABCIApp) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error) {
|
||||||
@ -37,7 +37,7 @@ func (a ABCIApp) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts clien
|
|||||||
Height: opts.Height,
|
Height: opts.Height,
|
||||||
Prove: opts.Prove,
|
Prove: opts.Prove,
|
||||||
})
|
})
|
||||||
return &ctypes.ResultABCIQuery{q}, nil
|
return &ctypes.ResultABCIQuery{Response: q}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Caller should call a.App.Commit() separately,
|
// NOTE: Caller should call a.App.Commit() separately,
|
||||||
@ -60,7 +60,7 @@ func (a ABCIApp) BroadcastTxAsync(tx types.Tx) (*ctypes.ResultBroadcastTx, error
|
|||||||
if !c.IsErr() {
|
if !c.IsErr() {
|
||||||
go func() { a.App.DeliverTx(tx) }() // nolint: errcheck
|
go func() { a.App.DeliverTx(tx) }() // nolint: errcheck
|
||||||
}
|
}
|
||||||
return &ctypes.ResultBroadcastTx{c.Code, c.Data, c.Log, tx.Hash()}, nil
|
return &ctypes.ResultBroadcastTx{Code: c.Code, Data: c.Data, Log: c.Log, Hash: tx.Hash()}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a ABCIApp) BroadcastTxSync(tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
|
func (a ABCIApp) BroadcastTxSync(tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
|
||||||
@ -69,7 +69,7 @@ func (a ABCIApp) BroadcastTxSync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)
|
|||||||
if !c.IsErr() {
|
if !c.IsErr() {
|
||||||
go func() { a.App.DeliverTx(tx) }() // nolint: errcheck
|
go func() { a.App.DeliverTx(tx) }() // nolint: errcheck
|
||||||
}
|
}
|
||||||
return &ctypes.ResultBroadcastTx{c.Code, c.Data, c.Log, tx.Hash()}, nil
|
return &ctypes.ResultBroadcastTx{Code: c.Code, Data: c.Data, Log: c.Log, Hash: tx.Hash()}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ABCIMock will send all abci related request to the named app,
|
// ABCIMock will send all abci related request to the named app,
|
||||||
@ -87,7 +87,7 @@ func (m ABCIMock) ABCIInfo() (*ctypes.ResultABCIInfo, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &ctypes.ResultABCIInfo{res.(abci.ResponseInfo)}, nil
|
return &ctypes.ResultABCIInfo{Response: res.(abci.ResponseInfo)}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m ABCIMock) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error) {
|
func (m ABCIMock) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error) {
|
||||||
@ -100,7 +100,7 @@ func (m ABCIMock) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts clie
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
resQuery := res.(abci.ResponseQuery)
|
resQuery := res.(abci.ResponseQuery)
|
||||||
return &ctypes.ResultABCIQuery{resQuery}, nil
|
return &ctypes.ResultABCIQuery{Response: resQuery}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m ABCIMock) BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
|
func (m ABCIMock) BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
|
||||||
|
@ -42,9 +42,9 @@ func TestCorsEnabled(t *testing.T) {
|
|||||||
req.Header.Set("Origin", origin)
|
req.Header.Set("Origin", origin)
|
||||||
c := &http.Client{}
|
c := &http.Client{}
|
||||||
resp, err := c.Do(req)
|
resp, err := c.Do(req)
|
||||||
|
require.Nil(t, err, "%+v", err)
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
require.Nil(t, err, "%+v", err)
|
|
||||||
assert.Equal(t, resp.Header.Get("Access-Control-Allow-Origin"), origin)
|
assert.Equal(t, resp.Header.Get("Access-Control-Allow-Origin"), origin)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ func ABCIQuery(path string, data cmn.HexBytes, height int64, prove bool) (*ctype
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
logger.Info("ABCIQuery", "path", path, "data", data, "result", resQuery)
|
logger.Info("ABCIQuery", "path", path, "data", data, "result", resQuery)
|
||||||
return &ctypes.ResultABCIQuery{*resQuery}, nil
|
return &ctypes.ResultABCIQuery{Response: *resQuery}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get some info about the application.
|
// Get some info about the application.
|
||||||
@ -101,5 +101,5 @@ func ABCIInfo() (*ctypes.ResultABCIInfo, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &ctypes.ResultABCIInfo{*resInfo}, nil
|
return &ctypes.ResultABCIInfo{Response: *resInfo}, nil
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,9 @@ func BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, e
|
|||||||
blockMetas = append(blockMetas, blockMeta)
|
blockMetas = append(blockMetas, blockMeta)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &ctypes.ResultBlockchainInfo{blockStore.Height(), blockMetas}, nil
|
return &ctypes.ResultBlockchainInfo{
|
||||||
|
LastHeight: blockStore.Height(),
|
||||||
|
BlockMetas: blockMetas}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// error if either min or max are negative or min < max
|
// error if either min or max are negative or min < max
|
||||||
@ -233,7 +235,7 @@ func Block(heightPtr *int64) (*ctypes.ResultBlock, error) {
|
|||||||
|
|
||||||
blockMeta := blockStore.LoadBlockMeta(height)
|
blockMeta := blockStore.LoadBlockMeta(height)
|
||||||
block := blockStore.LoadBlock(height)
|
block := blockStore.LoadBlock(height)
|
||||||
return &ctypes.ResultBlock{blockMeta, block}, nil
|
return &ctypes.ResultBlock{BlockMeta: blockMeta, Block: block}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get block commit at a given height.
|
// Get block commit at a given height.
|
||||||
|
@ -60,7 +60,9 @@ func Validators(heightPtr *int64) (*ctypes.ResultValidators, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &ctypes.ResultValidators{height, validators.Validators}, nil
|
return &ctypes.ResultValidators{
|
||||||
|
BlockHeight: height,
|
||||||
|
Validators: validators.Validators}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DumpConsensusState dumps consensus state.
|
// DumpConsensusState dumps consensus state.
|
||||||
@ -223,7 +225,9 @@ func DumpConsensusState() (*ctypes.ResultDumpConsensusState, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &ctypes.ResultDumpConsensusState{roundState, peerStates}, nil
|
return &ctypes.ResultDumpConsensusState{
|
||||||
|
RoundState: roundState,
|
||||||
|
Peers: peerStates}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConsensusState returns a concise summary of the consensus state.
|
// ConsensusState returns a concise summary of the consensus state.
|
||||||
@ -276,7 +280,7 @@ func DumpConsensusState() (*ctypes.ResultDumpConsensusState, error) {
|
|||||||
func ConsensusState() (*ctypes.ResultConsensusState, error) {
|
func ConsensusState() (*ctypes.ResultConsensusState, error) {
|
||||||
// Get self round state.
|
// Get self round state.
|
||||||
bz, err := consensusState.GetRoundStateSimpleJSON()
|
bz, err := consensusState.GetRoundStateSimpleJSON()
|
||||||
return &ctypes.ResultConsensusState{bz}, err
|
return &ctypes.ResultConsensusState{RoundState: bz}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the consensus parameters at the given block height.
|
// Get the consensus parameters at the given block height.
|
||||||
@ -327,5 +331,7 @@ func ConsensusParams(heightPtr *int64) (*ctypes.ResultConsensusParams, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &ctypes.ResultConsensusParams{BlockHeight: height, ConsensusParams: consensusparams}, nil
|
return &ctypes.ResultConsensusParams{
|
||||||
|
BlockHeight: height,
|
||||||
|
ConsensusParams: consensusparams}, nil
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ func Subscribe(wsCtx rpctypes.WSRPCContext, query string) (*ctypes.ResultSubscri
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for event := range ch {
|
for event := range ch {
|
||||||
tmResult := &ctypes.ResultEvent{query, event.(tmtypes.TMEventData)}
|
tmResult := &ctypes.ResultEvent{Query: query, Data: event.(tmtypes.TMEventData)}
|
||||||
wsCtx.TryWriteRPCResponse(rpctypes.NewRPCSuccessResponse(wsCtx.Codec(), rpctypes.JSONRPCStringID(fmt.Sprintf("%v#event", wsCtx.Request.ID)), tmResult))
|
wsCtx.TryWriteRPCResponse(rpctypes.NewRPCSuccessResponse(wsCtx.Codec(), rpctypes.JSONRPCStringID(fmt.Sprintf("%v#event", wsCtx.Request.ID)), tmResult))
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
@ -275,7 +275,7 @@ func UnconfirmedTxs(limit int) (*ctypes.ResultUnconfirmedTxs, error) {
|
|||||||
limit = validatePerPage(limit)
|
limit = validatePerPage(limit)
|
||||||
|
|
||||||
txs := mempool.ReapMaxTxs(limit)
|
txs := mempool.ReapMaxTxs(limit)
|
||||||
return &ctypes.ResultUnconfirmedTxs{len(txs), txs}, nil
|
return &ctypes.ResultUnconfirmedTxs{N: len(txs), Txs: txs}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get number of unconfirmed transactions.
|
// Get number of unconfirmed transactions.
|
||||||
|
@ -77,7 +77,7 @@ func UnsafeDialSeeds(seeds []string) (*ctypes.ResultDialSeeds, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return &ctypes.ResultDialSeeds{}, err
|
return &ctypes.ResultDialSeeds{}, err
|
||||||
}
|
}
|
||||||
return &ctypes.ResultDialSeeds{"Dialing seeds in progress. See /net_info for details"}, nil
|
return &ctypes.ResultDialSeeds{Log: "Dialing seeds in progress. See /net_info for details"}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func UnsafeDialPeers(peers []string, persistent bool) (*ctypes.ResultDialPeers, error) {
|
func UnsafeDialPeers(peers []string, persistent bool) (*ctypes.ResultDialPeers, error) {
|
||||||
@ -90,7 +90,7 @@ func UnsafeDialPeers(peers []string, persistent bool) (*ctypes.ResultDialPeers,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return &ctypes.ResultDialPeers{}, err
|
return &ctypes.ResultDialPeers{}, err
|
||||||
}
|
}
|
||||||
return &ctypes.ResultDialPeers{"Dialing peers in progress. See /net_info for details"}, nil
|
return &ctypes.ResultDialPeers{Log: "Dialing peers in progress. See /net_info for details"}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get genesis file.
|
// Get genesis file.
|
||||||
@ -136,5 +136,5 @@ func UnsafeDialPeers(peers []string, persistent bool) (*ctypes.ResultDialPeers,
|
|||||||
// }
|
// }
|
||||||
// ```
|
// ```
|
||||||
func Genesis() (*ctypes.ResultGenesis, error) {
|
func Genesis() (*ctypes.ResultGenesis, error) {
|
||||||
return &ctypes.ResultGenesis{genDoc}, nil
|
return &ctypes.ResultGenesis{Genesis: genDoc}, nil
|
||||||
}
|
}
|
||||||
|
@ -446,7 +446,7 @@ func fireEvents(logger log.Logger, eventBus types.BlockEventPublisher, block *ty
|
|||||||
})
|
})
|
||||||
|
|
||||||
for i, tx := range block.Data.Txs {
|
for i, tx := range block.Data.Txs {
|
||||||
eventBus.PublishEventTx(types.EventDataTx{types.TxResult{
|
eventBus.PublishEventTx(types.EventDataTx{TxResult: types.TxResult{
|
||||||
Height: block.Height,
|
Height: block.Height,
|
||||||
Index: uint32(i),
|
Index: uint32(i),
|
||||||
Tx: tx,
|
Tx: tx,
|
||||||
|
@ -22,7 +22,7 @@ type Node struct {
|
|||||||
rpcAddr string
|
rpcAddr string
|
||||||
|
|
||||||
IsValidator bool `json:"is_validator"` // validator or non-validator?
|
IsValidator bool `json:"is_validator"` // validator or non-validator?
|
||||||
pubKey crypto.PubKey `json:"pub_key"`
|
pubKey crypto.PubKey
|
||||||
|
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Online bool `json:"online"`
|
Online bool `json:"online"`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user