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
2a47c254
Commit
2a47c254
authored
Dec 11, 2018
by
mdj33
Committed by
vipwzw
Dec 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add search depth config
parent
2632b315
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
para.go
plugin/consensus/para/para.go
+12
-11
No files found.
plugin/consensus/para/para.go
View file @
2a47c254
...
...
@@ -46,8 +46,8 @@ var (
zeroHash
[
32
]
byte
grpcRecSize
=
30
*
1024
*
1024
//the size should be limited in server
//current miner tx take any privatekey for unify all nodes sign purpose, and para chain is free
minerPrivateKey
=
"6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b"
searchHashMatch
BlockDepth
int64
=
100
minerPrivateKey
=
"6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b"
searchHashMatch
Depth
int32
=
100
)
func
init
()
{
...
...
@@ -84,9 +84,9 @@ func New(cfg *types.Consensus, sub []byte) queue.Module {
emptyBlockInterval
=
cfg
.
EmptyBlockInterval
}
//if cfg.searchHashMatch
BlockDepth > 0 {
// searchHashMatchBlockDepth = cfg.searchHashMatch
BlockDepth
//
}
if
cfg
.
SearchHashMatched
BlockDepth
>
0
{
searchHashMatchDepth
=
cfg
.
SearchHashMatched
BlockDepth
}
pk
,
err
:=
hex
.
DecodeString
(
minerPrivateKey
)
if
err
!=
nil
{
...
...
@@ -508,8 +508,8 @@ func (client *client) switchHashMatchedBlock(currSeq *int64, preMainBlockHash *[
return
}
findDepth
:=
searchHashMatchBlock
Depth
for
height
:=
lastBlock
.
Height
;
height
>
0
&&
findD
epth
>
0
;
height
--
{
depth
:=
searchHashMatch
Depth
for
height
:=
lastBlock
.
Height
;
height
>
0
&&
d
epth
>
0
;
height
--
{
block
,
err
:=
client
.
GetBlockByHeight
(
height
)
if
err
!=
nil
{
return
...
...
@@ -522,11 +522,12 @@ func (client *client) switchHashMatchedBlock(currSeq *int64, preMainBlockHash *[
miner
.
MainBlockHeight
,
"mainHash"
,
common
.
Bytes2Hex
(
miner
.
MainBlockHash
))
mainSeq
,
err
:=
client
.
GetSeqByHashOnMainChain
(
miner
.
MainBlockHash
)
if
err
!=
nil
{
findD
epth
--
if
findD
epth
==
0
{
d
epth
--
if
d
epth
==
0
{
plog
.
Error
(
"switchHashMatchedBlock depth overflow"
,
"last info:mainHeight"
,
miner
.
MainBlockHeight
,
"mainHash"
,
common
.
Bytes2Hex
(
miner
.
MainBlockHash
),
"search depth"
,
searchHashMatchBlockDepth
)
panic
(
"switchHashMatchedBlock depth overflow, restart and re-connect main node"
)
"mainHash"
,
common
.
Bytes2Hex
(
miner
.
MainBlockHash
),
"search startHeight"
,
lastBlock
.
Height
,
"curHeight"
,
miner
.
Height
,
"search depth"
,
searchHashMatchDepth
)
panic
(
"search HashMatchedBlock overflow, re-setting search depth and restart to try"
)
}
if
height
==
1
{
plog
.
Error
(
"switchHashMatchedBlock search to height=1 not found"
,
"lastBlockHeight"
,
lastBlock
.
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