7 abci "github.com/tendermint/abci/types"
8 "github.com/tendermint/go-crypto"
9 "github.com/tendermint/go-wire/data"
10 "github.com/bytom/protocol/bc"
11 "github.com/bytom/p2p"
12 "github.com/bytom/types"
15 type BlockNonce [8]byte
17 type ResultBlockchainInfo struct {
18 LastHeight int `json:"last_height"`
19 BlockMetas []*types.BlockMeta `json:"block_metas"`
22 type ResultGenesis struct {
23 Genesis *types.GenesisDoc `json:"genesis"`
26 type ResultBlock struct {
27 BlockMeta *types.BlockMeta `json:"block_meta"`
28 Block *types.Block `json:"block"`
31 type ResultCommit struct {
32 Header *types.Header `json:"header"`
33 Commit *types.Commit `json:"commit"`
34 CanonicalCommit bool `json:"canonical"`
37 type ResultStatus struct {
38 NodeInfo *p2p.NodeInfo `json:"node_info"`
39 PubKey crypto.PubKey `json:"pub_key"`
40 LatestBlockHash data.Bytes `json:"latest_block_hash"`
41 LatestAppHash data.Bytes `json:"latest_app_hash"`
42 LatestBlockHeight int `json:"latest_block_height"`
43 LatestBlockTime int64 `json:"latest_block_time"` // nano
46 func (s *ResultStatus) TxIndexEnabled() bool {
47 if s == nil || s.NodeInfo == nil {
50 for _, s := range s.NodeInfo.Other {
51 info := strings.Split(s, "=")
52 if len(info) == 2 && info[0] == "tx_index" {
53 return info[1] == "on"
59 type ResultNetInfo struct {
60 Listening bool `json:"listening"`
61 Listeners []string `json:"listeners"`
62 Peers []Peer `json:"peers"`
65 type ResultBlockHeaderInfo struct {
66 Version int32 `json:"version"`
67 //Height uint64 `json:"height"`
68 MerkleRoot bc.Hash `json:"merkleroot"`
69 PreviousBlockHash bc.Hash `json:"prevblockhash"`
70 TimestampMS time.Time `json:"timestamp"`
71 Bits uint64 `json:"bits"`
72 Nonce uint64 `json:"nonce"`
75 type ResultDialSeeds struct {
76 Log string `json:"log"`
80 p2p.NodeInfo `json:"node_info"`
81 IsOutbound bool `json:"is_outbound"`
82 ConnectionStatus p2p.ConnectionStatus `json:"connection_status"`
85 type ResultValidators struct {
86 BlockHeight int `json:"block_height"`
87 Validators []*types.Validator `json:"validators"`
90 type ResultDumpConsensusState struct {
91 RoundState string `json:"round_state"`
92 PeerRoundStates []string `json:"peer_round_states"`
95 type ResultBroadcastTx struct {
96 Code abci.CodeType `json:"code"`
97 Data data.Bytes `json:"data"`
98 Log string `json:"log"`
100 Hash data.Bytes `json:"hash"`
103 type ResultBroadcastTxCommit struct {
104 CheckTx abci.Result `json:"check_tx"`
105 DeliverTx abci.Result `json:"deliver_tx"`
106 Hash data.Bytes `json:"hash"`
107 Height int `json:"height"`
110 type ResultTx struct {
111 Height int `json:"height"`
112 Index int `json:"index"`
113 TxResult abci.Result `json:"tx_result"`
114 Tx types.Tx `json:"tx"`
115 Proof types.TxProof `json:"proof,omitempty"`
118 type ResultUnconfirmedTxs struct {
120 Txs []types.Tx `json:"txs"`
123 type ResultABCIInfo struct {
124 Response abci.ResponseInfo `json:"response"`
127 type ResultABCIQuery struct {
128 *abci.ResultQuery `json:"response"`
131 type ResultUnsafeFlushMempool struct{}
133 type ResultUnsafeProfile struct{}
135 type ResultSubscribe struct{}
137 type ResultUnsubscribe struct{}
139 type ResultEvent struct {
140 Name string `json:"name"`
141 Data types.TMEventData `json:"data"`