From: paladz <453256728@qq.com> Date: Thu, 24 May 2018 12:24:45 +0000 (+0800) Subject: delete unsed file X-Git-Tag: v1.0.5~11^2~19^2 X-Git-Url: http://git.osdn.net/view?p=bytom%2Fbytom.git;a=commitdiff_plain;h=218222c4f8695921795147d4093b3d39ccb7078c delete unsed file --- diff --git a/blockchain/rpc/types/responses.go b/blockchain/rpc/types/responses.go deleted file mode 100644 index 710f0016..00000000 --- a/blockchain/rpc/types/responses.go +++ /dev/null @@ -1,69 +0,0 @@ -package core_types - -import ( - "strings" - "time" - - "github.com/tendermint/go-crypto" - "github.com/tendermint/go-wire/data" - - "github.com/bytom/p2p" - "github.com/bytom/protocol/bc" -) - -type BlockNonce [8]byte - -type ResultBlockchainInfo struct { - LastHeight uint64 `json:"last_height"` -} - -type ResultBlock struct { -} - -type ResultStatus struct { - NodeInfo *p2p.NodeInfo `json:"node_info"` - PubKey crypto.PubKey `json:"pub_key"` - LatestBlockHash data.Bytes `json:"latest_block_hash"` - LatestAppHash data.Bytes `json:"latest_app_hash"` - LatestBlockHeight int `json:"latest_block_height"` - LatestBlockTime int64 `json:"latest_block_time"` // nano -} - -func (s *ResultStatus) TxIndexEnabled() bool { - if s == nil || s.NodeInfo == nil { - return false - } - for _, s := range s.NodeInfo.Other { - info := strings.Split(s, "=") - if len(info) == 2 && info[0] == "tx_index" { - return info[1] == "on" - } - } - return false -} - -type ResultNetInfo struct { - Listening bool `json:"listening"` - Listeners []string `json:"listeners"` - Peers []Peer `json:"peers"` -} - -type ResultBlockHeaderInfo struct { - Version int32 `json:"version"` - //Height uint64 `json:"height"` - MerkleRoot bc.Hash `json:"merkleroot"` - PreviousBlockHash bc.Hash `json:"prevblockhash"` - TimestampMS time.Time `json:"timestamp"` - Bits uint64 `json:"bits"` - Nonce uint64 `json:"nonce"` -} - -type ResultDialSeeds struct { - Log string `json:"log"` -} - -type Peer struct { - p2p.NodeInfo `json:"node_info"` - IsOutbound bool `json:"is_outbound"` - ConnectionStatus p2p.ConnectionStatus `json:"connection_status"` -} diff --git a/blockchain/rpc/types/responses_test.go b/blockchain/rpc/types/responses_test.go deleted file mode 100644 index 9f82bbd8..00000000 --- a/blockchain/rpc/types/responses_test.go +++ /dev/null @@ -1,38 +0,0 @@ -package core_types - -import ( - "testing" - - "github.com/bytom/p2p" - "github.com/stretchr/testify/assert" -) - -func TestStatusIndexer(t *testing.T) { - assert := assert.New(t) - - var status *ResultStatus - assert.False(status.TxIndexEnabled()) - - status = &ResultStatus{} - assert.False(status.TxIndexEnabled()) - - status.NodeInfo = &p2p.NodeInfo{} - assert.False(status.TxIndexEnabled()) - - cases := []struct { - expected bool - other []string - }{ - {false, nil}, - {false, []string{}}, - {false, []string{"a=b"}}, - {false, []string{"tx_indexiskv", "some=dood"}}, - {true, []string{"tx_index=on", "tx_index=other"}}, - {true, []string{"^(*^(", "tx_index=on", "a=n=b=d="}}, - } - - for _, tc := range cases { - status.NodeInfo.Other = tc.other - assert.Equal(tc.expected, status.TxIndexEnabled()) - } -}