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
ab8e9cb8
Commit
ab8e9cb8
authored
Jan 16, 2019
by
mdj33
Committed by
vipwzw
Jan 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tx hash count miner tx in
parent
add412bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
para.go
plugin/consensus/para/para.go
+7
-5
No files found.
plugin/consensus/para/para.go
View file @
ab8e9cb8
...
...
@@ -505,6 +505,7 @@ func (client *client) switchHashMatchedBlock(currSeq int64) (int64, []byte, erro
if
err
!=
nil
{
return
-
2
,
nil
,
err
}
//当前block结构已经有mainHash和MainHeight但是从blockchain获取的block还没有写入,以后如果获取到,可以替换从minerTx获取
miner
,
err
:=
getMinerTxInfo
(
block
)
if
err
!=
nil
{
return
-
2
,
nil
,
err
...
...
@@ -684,19 +685,20 @@ func (client *client) addMinerTx(preStateHash []byte, block *types.Block, main *
func
(
client
*
client
)
createBlock
(
lastBlock
*
types
.
Block
,
txs
[]
*
types
.
Transaction
,
seq
int64
,
mainBlock
*
types
.
BlockSeq
)
error
{
var
newblock
types
.
Block
plog
.
Debug
(
fmt
.
Sprintf
(
"the len txs is: %v"
,
len
(
txs
)))
newblock
.
ParentHash
=
lastBlock
.
Hash
()
newblock
.
Height
=
lastBlock
.
Height
+
1
newblock
.
Txs
=
txs
err
:=
client
.
addMinerTx
(
lastBlock
.
StateHash
,
&
newblock
,
mainBlock
)
if
err
!=
nil
{
return
err
}
//挖矿固定难度
newblock
.
Difficulty
=
types
.
GetP
(
0
)
.
PowLimitBits
newblock
.
TxHash
=
merkle
.
CalcMerkleRoot
(
newblock
.
Txs
)
newblock
.
BlockTime
=
mainBlock
.
Detail
.
Block
.
BlockTime
newblock
.
MainHash
=
mainBlock
.
Detail
.
Block
.
Hash
()
newblock
.
MainHash
=
mainBlock
.
Seq
.
Hash
newblock
.
MainHeight
=
mainBlock
.
Detail
.
Block
.
Height
err
:=
client
.
addMinerTx
(
lastBlock
.
StateHash
,
&
newblock
,
mainBlock
)
if
err
!=
nil
{
return
err
}
err
=
client
.
WriteBlock
(
lastBlock
.
StateHash
,
&
newblock
,
seq
)
...
...
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