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
3dda8945
Commit
3dda8945
authored
Nov 26, 2018
by
Hugo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix vet ineffassign problem in tendermint and valnode
parent
2e301762
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
3 deletions
+14
-3
consensus_state.go
plugin/consensus/tendermint/consensus_state.go
+1
-1
peer_set.go
plugin/consensus/tendermint/peer_set.go
+12
-1
tendermint.go
plugin/consensus/tendermint/tendermint.go
+1
-1
No files found.
plugin/consensus/tendermint/consensus_state.go
View file @
3dda8945
...
@@ -1180,7 +1180,7 @@ func (cs *ConsensusState) defaultSetProposal(proposal *tmtypes.Proposal) error {
...
@@ -1180,7 +1180,7 @@ func (cs *ConsensusState) defaultSetProposal(proposal *tmtypes.Proposal) error {
// NOTE: block is not necessarily valid.
// NOTE: block is not necessarily valid.
// Asynchronously triggers either enterPrevote (before we timeout of propose) or tryFinalizeCommit, once we have the full block.
// Asynchronously triggers either enterPrevote (before we timeout of propose) or tryFinalizeCommit, once we have the full block.
func
(
cs
*
ConsensusState
)
addProposalBlock
(
proposalBlock
*
tmtypes
.
TendermintBlock
)
(
err
error
)
{
func
(
cs
*
ConsensusState
)
addProposalBlock
(
proposalBlock
*
tmtypes
.
TendermintBlock
)
(
err
error
)
{
block
:=
&
ttypes
.
TendermintBlock
{
proposalBlock
}
block
:=
&
ttypes
.
TendermintBlock
{
TendermintBlock
:
proposalBlock
}
height
,
round
:=
block
.
Header
.
Height
,
block
.
Header
.
Round
height
,
round
:=
block
.
Header
.
Height
,
block
.
Header
.
Round
tendermintlog
.
Debug
(
fmt
.
Sprintf
(
"Consensus receive proposal block. Current: %v/%v/%v"
,
cs
.
Height
,
cs
.
Round
,
cs
.
Step
),
tendermintlog
.
Debug
(
fmt
.
Sprintf
(
"Consensus receive proposal block. Current: %v/%v/%v"
,
cs
.
Height
,
cs
.
Round
,
cs
.
Step
),
"block(H/R/hash)"
,
fmt
.
Sprintf
(
"%v/%v/%X"
,
height
,
round
,
block
.
Hash
()))
"block(H/R/hash)"
,
fmt
.
Sprintf
(
"%v/%v/%X"
,
height
,
round
,
block
.
Hash
()))
...
...
plugin/consensus/tendermint/peer_set.go
View file @
3dda8945
...
@@ -283,28 +283,39 @@ func (pc *peerConn) HandshakeTimeout(
...
@@ -283,28 +283,39 @@ func (pc *peerConn) HandshakeTimeout(
func
()
{
func
()
{
info
,
err1
:=
json
.
Marshal
(
ourNodeInfo
)
info
,
err1
:=
json
.
Marshal
(
ourNodeInfo
)
if
err1
!=
nil
{
if
err1
!=
nil
{
tendermintlog
.
Error
(
"Peer handshake
pee
rNodeInfo failed"
,
"err"
,
err1
)
tendermintlog
.
Error
(
"Peer handshake
Marshal ou
rNodeInfo failed"
,
"err"
,
err1
)
return
return
}
}
frame
:=
make
([]
byte
,
4
)
frame
:=
make
([]
byte
,
4
)
binary
.
BigEndian
.
PutUint32
(
frame
,
uint32
(
len
(
info
)))
binary
.
BigEndian
.
PutUint32
(
frame
,
uint32
(
len
(
info
)))
_
,
err1
=
pc
.
conn
.
Write
(
frame
)
_
,
err1
=
pc
.
conn
.
Write
(
frame
)
if
err1
!=
nil
{
tendermintlog
.
Error
(
"Peer handshake write info size failed"
,
"err"
,
err1
)
return
}
_
,
err1
=
pc
.
conn
.
Write
(
info
[
:
])
_
,
err1
=
pc
.
conn
.
Write
(
info
[
:
])
if
err1
!=
nil
{
tendermintlog
.
Error
(
"Peer handshake write info failed"
,
"err"
,
err1
)
return
}
},
},
func
()
{
func
()
{
readBuffer
:=
make
([]
byte
,
4
)
readBuffer
:=
make
([]
byte
,
4
)
_
,
err2
=
io
.
ReadFull
(
pc
.
conn
,
readBuffer
[
:
])
_
,
err2
=
io
.
ReadFull
(
pc
.
conn
,
readBuffer
[
:
])
if
err2
!=
nil
{
if
err2
!=
nil
{
tendermintlog
.
Error
(
"Peer handshake read info size failed"
,
"err"
,
err1
)
return
return
}
}
len
:=
binary
.
BigEndian
.
Uint32
(
readBuffer
)
len
:=
binary
.
BigEndian
.
Uint32
(
readBuffer
)
readBuffer
=
make
([]
byte
,
len
)
readBuffer
=
make
([]
byte
,
len
)
_
,
err2
=
io
.
ReadFull
(
pc
.
conn
,
readBuffer
[
:
])
_
,
err2
=
io
.
ReadFull
(
pc
.
conn
,
readBuffer
[
:
])
if
err2
!=
nil
{
if
err2
!=
nil
{
tendermintlog
.
Error
(
"Peer handshake read info failed"
,
"err"
,
err1
)
return
return
}
}
err2
=
json
.
Unmarshal
(
readBuffer
,
&
peerNodeInfo
)
err2
=
json
.
Unmarshal
(
readBuffer
,
&
peerNodeInfo
)
if
err2
!=
nil
{
if
err2
!=
nil
{
tendermintlog
.
Error
(
"Peer handshake Unmarshal failed"
,
"err"
,
err1
)
return
return
}
}
tendermintlog
.
Info
(
"Peer handshake"
,
"peerNodeInfo"
,
peerNodeInfo
)
tendermintlog
.
Info
(
"Peer handshake"
,
"peerNodeInfo"
,
peerNodeInfo
)
...
...
plugin/consensus/tendermint/tendermint.go
View file @
3dda8945
...
@@ -458,7 +458,7 @@ func (client *Client) CommitBlock(propBlock *types.Block) error {
...
@@ -458,7 +458,7 @@ func (client *Client) CommitBlock(propBlock *types.Block) error {
// CheckCommit by height
// CheckCommit by height
func
(
client
*
Client
)
CheckCommit
(
height
int64
)
bool
{
func
(
client
*
Client
)
CheckCommit
(
height
int64
)
bool
{
retry
:=
0
retry
:=
0
newHeight
:=
int64
(
1
)
var
newHeight
int64
for
{
for
{
newHeight
=
client
.
GetCurrentHeight
()
newHeight
=
client
.
GetCurrentHeight
()
if
newHeight
>=
height
{
if
newHeight
>=
height
{
...
...
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