types: move NodeInfo from p2p (#6618)

This commit is contained in:
Sam Kleinman
2021-06-24 12:18:19 -04:00
committed by GitHub
parent 2cc872543b
commit 9ffa7e8a2b
28 changed files with 219 additions and 177 deletions

View File

@@ -47,7 +47,7 @@ type Consensus interface {
type transport interface {
Listeners() []string
IsListening() bool
NodeInfo() p2p.NodeInfo
NodeInfo() types.NodeInfo
}
type peers interface {

View File

@@ -108,9 +108,9 @@ type ValidatorInfo struct {
// Node Status
type ResultStatus struct {
NodeInfo p2p.NodeInfo `json:"node_info"`
SyncInfo SyncInfo `json:"sync_info"`
ValidatorInfo ValidatorInfo `json:"validator_info"`
NodeInfo types.NodeInfo `json:"node_info"`
SyncInfo SyncInfo `json:"sync_info"`
ValidatorInfo ValidatorInfo `json:"validator_info"`
}
// Is TxIndexing enabled
@@ -141,7 +141,7 @@ type ResultDialPeers struct {
// A peer
type Peer struct {
NodeInfo p2p.NodeInfo `json:"node_info"`
NodeInfo types.NodeInfo `json:"node_info"`
IsOutbound bool `json:"is_outbound"`
ConnectionStatus p2p.ConnectionStatus `json:"connection_status"`
RemoteIP string `json:"remote_ip"`

View File

@@ -4,8 +4,7 @@ import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/tendermint/tendermint/internal/p2p"
"github.com/tendermint/tendermint/types"
)
func TestStatusIndexer(t *testing.T) {
@@ -15,17 +14,17 @@ func TestStatusIndexer(t *testing.T) {
status = &ResultStatus{}
assert.False(t, status.TxIndexEnabled())
status.NodeInfo = p2p.NodeInfo{}
status.NodeInfo = types.NodeInfo{}
assert.False(t, status.TxIndexEnabled())
cases := []struct {
expected bool
other p2p.NodeInfoOther
other types.NodeInfoOther
}{
{false, p2p.NodeInfoOther{}},
{false, p2p.NodeInfoOther{TxIndex: "aa"}},
{false, p2p.NodeInfoOther{TxIndex: "off"}},
{true, p2p.NodeInfoOther{TxIndex: "on"}},
{false, types.NodeInfoOther{}},
{false, types.NodeInfoOther{TxIndex: "aa"}},
{false, types.NodeInfoOther{TxIndex: "off"}},
{true, types.NodeInfoOther{TxIndex: "on"}},
}
for _, tc := range cases {