Merge branch 'develop' into anton/new-pubsub

This commit is contained in:
Anton Kaliaev
2019-02-13 11:47:14 +04:00
committed by GitHub
75 changed files with 1303 additions and 577 deletions

View File

@ -63,7 +63,7 @@ func ABCIQuery(path string, data cmn.HexBytes, height int64, prove bool) (*ctype
return nil, err
}
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.
@ -101,5 +101,5 @@ func ABCIInfo() (*ctypes.ResultABCIInfo, error) {
if err != nil {
return nil, err
}
return &ctypes.ResultABCIInfo{*resInfo}, nil
return &ctypes.ResultABCIInfo{Response: *resInfo}, nil
}

View File

@ -85,7 +85,9 @@ func BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, e
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
@ -233,7 +235,7 @@ func Block(heightPtr *int64) (*ctypes.ResultBlock, error) {
blockMeta := blockStore.LoadBlockMeta(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.

View File

@ -60,7 +60,9 @@ func Validators(heightPtr *int64) (*ctypes.ResultValidators, error) {
if err != nil {
return nil, err
}
return &ctypes.ResultValidators{height, validators.Validators}, nil
return &ctypes.ResultValidators{
BlockHeight: height,
Validators: validators.Validators}, nil
}
// DumpConsensusState dumps consensus state.
@ -223,7 +225,9 @@ func DumpConsensusState() (*ctypes.ResultDumpConsensusState, error) {
if err != nil {
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.
@ -276,7 +280,7 @@ func DumpConsensusState() (*ctypes.ResultDumpConsensusState, error) {
func ConsensusState() (*ctypes.ResultConsensusState, error) {
// Get self round state.
bz, err := consensusState.GetRoundStateSimpleJSON()
return &ctypes.ResultConsensusState{bz}, err
return &ctypes.ResultConsensusState{RoundState: bz}, err
}
// Get the consensus parameters at the given block height.
@ -327,5 +331,7 @@ func ConsensusParams(heightPtr *int64) (*ctypes.ResultConsensusParams, error) {
if err != nil {
return nil, err
}
return &ctypes.ResultConsensusParams{BlockHeight: height, ConsensusParams: consensusparams}, nil
return &ctypes.ResultConsensusParams{
BlockHeight: height,
ConsensusParams: consensusparams}, nil
}

View File

@ -110,7 +110,7 @@ func Subscribe(wsCtx rpctypes.WSRPCContext, query string) (*ctypes.ResultSubscri
for {
select {
case msg := <-sub.Out():
resultEvent := &ctypes.ResultEvent{query, msg.Data(), msg.Tags()}
resultEvent := &ctypes.ResultEvent{Query: query, Data: msg.Data(), Tags: msg.Tags()}
wsCtx.TryWriteRPCResponse(
rpctypes.NewRPCSuccessResponse(
wsCtx.Codec(),

View File

@ -268,7 +268,7 @@ func UnconfirmedTxs(limit int) (*ctypes.ResultUnconfirmedTxs, error) {
limit = validatePerPage(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.

View File

@ -77,7 +77,7 @@ func UnsafeDialSeeds(seeds []string) (*ctypes.ResultDialSeeds, error) {
if err != nil {
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) {
@ -90,7 +90,7 @@ func UnsafeDialPeers(peers []string, persistent bool) (*ctypes.ResultDialPeers,
if err != nil {
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.
@ -136,5 +136,5 @@ func UnsafeDialPeers(peers []string, persistent bool) (*ctypes.ResultDialPeers,
// }
// ```
func Genesis() (*ctypes.ResultGenesis, error) {
return &ctypes.ResultGenesis{genDoc}, nil
return &ctypes.ResultGenesis{Genesis: genDoc}, nil
}