Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
9a70e5fd
Commit
9a70e5fd
authored
Nov 22, 2018
by
Hugo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix go vet problem
parent
5d10cc15
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
15 deletions
+13
-15
consensus_state.go
plugin/consensus/tendermint/consensus_state.go
+1
-1
node.go
plugin/consensus/tendermint/node.go
+10
-10
state.go
plugin/consensus/tendermint/state.go
+1
-1
block.go
plugin/consensus/tendermint/types/block.go
+0
-1
height_vote_set.go
plugin/consensus/tendermint/types/height_vote_set.go
+0
-1
util.go
plugin/consensus/tendermint/types/util.go
+1
-1
No files found.
plugin/consensus/tendermint/consensus_state.go
View file @
9a70e5fd
...
@@ -862,7 +862,7 @@ func (cs *ConsensusState) enterPrecommit(height int64, round int) {
...
@@ -862,7 +862,7 @@ func (cs *ConsensusState) enterPrecommit(height int64, round int) {
// the latest POLRound should be this round
// the latest POLRound should be this round
polRound
,
_
:=
cs
.
Votes
.
POLInfo
()
polRound
,
_
:=
cs
.
Votes
.
POLInfo
()
if
polRound
<
round
{
if
polRound
<
round
{
panic
(
fmt
.
Sprintf
(
"Panicked on a Sanity Check: %v"
,
fmt
.
Sprintf
(
"This POLRound should be %v but got %"
,
round
,
polRound
)))
panic
(
fmt
.
Sprintf
(
"Panicked on a Sanity Check: %v"
,
fmt
.
Sprintf
(
"This POLRound should be %v but got %
v
"
,
round
,
polRound
)))
}
}
// +2/3 prevoted nil. Unlock and precommit nil.
// +2/3 prevoted nil. Unlock and precommit nil.
...
...
plugin/consensus/tendermint/node.go
View file @
9a70e5fd
...
@@ -408,7 +408,7 @@ func (node *Node) addInboundPeer(conn net.Conn) error {
...
@@ -408,7 +408,7 @@ func (node *Node) addInboundPeer(conn net.Conn) error {
// peer to the switch and to all registered reactors.
// peer to the switch and to all registered reactors.
// NOTE: This performs a blocking handshake before the peer is added.
// NOTE: This performs a blocking handshake before the peer is added.
// NOTE: If error is returned, caller is responsible for calling peer.CloseConn()
// NOTE: If error is returned, caller is responsible for calling peer.CloseConn()
func
(
node
*
Node
)
addPeer
(
pc
peerConn
)
error
{
func
(
node
*
Node
)
addPeer
(
pc
*
peerConn
)
error
{
addr
:=
pc
.
conn
.
RemoteAddr
()
addr
:=
pc
.
conn
.
RemoteAddr
()
if
err
:=
node
.
FilterConnByAddr
(
addr
);
err
!=
nil
{
if
err
:=
node
.
FilterConnByAddr
(
addr
);
err
!=
nil
{
return
err
return
err
...
@@ -472,7 +472,7 @@ func (node *Node) addPeer(pc peerConn) error {
...
@@ -472,7 +472,7 @@ func (node *Node) addPeer(pc peerConn) error {
// All good. Start peer
// All good. Start peer
if
node
.
IsRunning
()
{
if
node
.
IsRunning
()
{
pc
.
SetTransferChannel
(
node
.
state
.
peerMsgQueue
)
pc
.
SetTransferChannel
(
node
.
state
.
peerMsgQueue
)
if
err
=
node
.
startInitPeer
(
&
pc
);
err
!=
nil
{
if
err
=
node
.
startInitPeer
(
pc
);
err
!=
nil
{
return
err
return
err
}
}
}
}
...
@@ -480,7 +480,7 @@ func (node *Node) addPeer(pc peerConn) error {
...
@@ -480,7 +480,7 @@ func (node *Node) addPeer(pc peerConn) error {
// Add the peer to .peers.
// Add the peer to .peers.
// We start it first so that a peer in the list is safe to Stop.
// We start it first so that a peer in the list is safe to Stop.
// It should not err since we already checked peers.Has().
// It should not err since we already checked peers.Has().
if
err
:=
node
.
peerSet
.
Add
(
&
pc
);
err
!=
nil
{
if
err
:=
node
.
peerSet
.
Add
(
pc
);
err
!=
nil
{
return
err
return
err
}
}
//node.metrics.Peers.Add(float64(1))
//node.metrics.Peers.Add(float64(1))
...
@@ -686,18 +686,18 @@ func dial(addr string) (net.Conn, error) {
...
@@ -686,18 +686,18 @@ func dial(addr string) (net.Conn, error) {
return
conn
,
nil
return
conn
,
nil
}
}
func
newOutboundPeerConn
(
addr
string
,
ourNodePrivKey
crypto
.
PrivKey
,
onPeerError
func
(
Peer
,
interface
{}),
state
*
ConsensusState
,
evpool
*
EvidencePool
)
(
peerConn
,
error
)
{
func
newOutboundPeerConn
(
addr
string
,
ourNodePrivKey
crypto
.
PrivKey
,
onPeerError
func
(
Peer
,
interface
{}),
state
*
ConsensusState
,
evpool
*
EvidencePool
)
(
*
peerConn
,
error
)
{
conn
,
err
:=
dial
(
addr
)
conn
,
err
:=
dial
(
addr
)
if
err
!=
nil
{
if
err
!=
nil
{
return
peerConn
{},
fmt
.
Errorf
(
"Error creating peer:%v"
,
err
)
return
&
peerConn
{},
fmt
.
Errorf
(
"Error creating peer:%v"
,
err
)
}
}
pc
,
err
:=
newPeerConn
(
conn
,
true
,
true
,
ourNodePrivKey
,
onPeerError
,
state
,
evpool
)
pc
,
err
:=
newPeerConn
(
conn
,
true
,
true
,
ourNodePrivKey
,
onPeerError
,
state
,
evpool
)
if
err
!=
nil
{
if
err
!=
nil
{
if
cerr
:=
conn
.
Close
();
cerr
!=
nil
{
if
cerr
:=
conn
.
Close
();
cerr
!=
nil
{
return
peerConn
{},
fmt
.
Errorf
(
"newPeerConn failed:%v, connection close failed:%v"
,
err
,
cerr
)
return
&
peerConn
{},
fmt
.
Errorf
(
"newPeerConn failed:%v, connection close failed:%v"
,
err
,
cerr
)
}
}
return
peerConn
{},
err
return
&
peerConn
{},
err
}
}
return
pc
,
nil
return
pc
,
nil
...
@@ -709,7 +709,7 @@ func newInboundPeerConn(
...
@@ -709,7 +709,7 @@ func newInboundPeerConn(
onPeerError
func
(
Peer
,
interface
{}),
onPeerError
func
(
Peer
,
interface
{}),
state
*
ConsensusState
,
state
*
ConsensusState
,
evpool
*
EvidencePool
,
evpool
*
EvidencePool
,
)
(
peerConn
,
error
)
{
)
(
*
peerConn
,
error
)
{
// TODO: issue PoW challenge
// TODO: issue PoW challenge
...
@@ -723,7 +723,7 @@ func newPeerConn(
...
@@ -723,7 +723,7 @@ func newPeerConn(
onPeerError
func
(
Peer
,
interface
{}),
onPeerError
func
(
Peer
,
interface
{}),
state
*
ConsensusState
,
state
*
ConsensusState
,
evpool
*
EvidencePool
,
evpool
*
EvidencePool
,
)
(
pc
peerConn
,
err
error
)
{
)
(
pc
*
peerConn
,
err
error
)
{
conn
:=
rawConn
conn
:=
rawConn
// Set deadline for secret handshake
// Set deadline for secret handshake
...
@@ -739,7 +739,7 @@ func newPeerConn(
...
@@ -739,7 +739,7 @@ func newPeerConn(
}
}
// Only the information we already have
// Only the information we already have
return
peerConn
{
return
&
peerConn
{
outbound
:
outbound
,
outbound
:
outbound
,
persistent
:
persistent
,
persistent
:
persistent
,
conn
:
conn
,
conn
:
conn
,
...
...
plugin/consensus/tendermint/state.go
View file @
9a70e5fd
...
@@ -174,7 +174,7 @@ func MakeGenesisState(genDoc *ttypes.GenesisDoc) (State, error) {
...
@@ -174,7 +174,7 @@ func MakeGenesisState(genDoc *ttypes.GenesisDoc) (State, error) {
for
i
,
val
:=
range
genDoc
.
Validators
{
for
i
,
val
:=
range
genDoc
.
Validators
{
pubKey
,
err
:=
ttypes
.
PubKeyFromString
(
val
.
PubKey
.
Data
)
pubKey
,
err
:=
ttypes
.
PubKeyFromString
(
val
.
PubKey
.
Data
)
if
err
!=
nil
{
if
err
!=
nil
{
return
State
{},
fmt
.
Errorf
(
"Error validate[
i
] in genesis file: %v"
,
i
,
err
)
return
State
{},
fmt
.
Errorf
(
"Error validate[
%v
] in genesis file: %v"
,
i
,
err
)
}
}
// Make validator
// Make validator
...
...
plugin/consensus/tendermint/types/block.go
View file @
9a70e5fd
...
@@ -505,5 +505,4 @@ func (data *EvidenceData) StringIndented(indent string) string {
...
@@ -505,5 +505,4 @@ func (data *EvidenceData) StringIndented(indent string) string {
%s}#%v`
,
%s}#%v`
,
indent
,
strings
.
Join
(
evStrings
,
"
\n
"
+
indent
+
" "
),
indent
,
strings
.
Join
(
evStrings
,
"
\n
"
+
indent
+
" "
),
indent
,
data
.
hash
)
indent
,
data
.
hash
)
return
""
}
}
plugin/consensus/tendermint/types/height_vote_set.go
View file @
9a70e5fd
...
@@ -171,7 +171,6 @@ func (hvs *HeightVoteSet) getVoteSet(round int, type_ byte) *VoteSet {
...
@@ -171,7 +171,6 @@ func (hvs *HeightVoteSet) getVoteSet(round int, type_ byte) *VoteSet {
return
rvs
.
Precommits
return
rvs
.
Precommits
default
:
default
:
panic
(
Fmt
(
"Panicked on a Sanity Check: %v"
,
Fmt
(
"Unexpected vote type %X"
,
type_
)))
panic
(
Fmt
(
"Panicked on a Sanity Check: %v"
,
Fmt
(
"Unexpected vote type %X"
,
type_
)))
return
nil
}
}
}
}
...
...
plugin/consensus/tendermint/types/util.go
View file @
9a70e5fd
...
@@ -189,7 +189,7 @@ func PanicQ(v interface{}) {
...
@@ -189,7 +189,7 @@ func PanicQ(v interface{}) {
//--------------------BitArray------------------------
//--------------------BitArray------------------------
type
BitArray
struct
{
type
BitArray
struct
{
*
tmtypes
.
TendermintBitArray
*
tmtypes
.
TendermintBitArray
mtx
sync
.
Mutex
`json:"-"`
mtx
sync
.
Mutex
}
}
// There is no BitArray whose Size is 0. Use nil instead.
// There is no BitArray whose Size is 0. Use nil instead.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment