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
1239ea28
Commit
1239ea28
authored
Jul 24, 2020
by
madengji
Committed by
33cn
Aug 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
para bind miner
parent
d1046df7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
73 additions
and
0 deletions
+73
-0
chain33.para.toml
chain33.para.toml
+6
-0
action.go
plugin/dapp/paracross/executor/action.go
+9
-0
exec.go
plugin/dapp/paracross/executor/exec.go
+6
-0
kv.go
plugin/dapp/paracross/executor/kv.go
+20
-0
reward.go
plugin/dapp/paracross/executor/reward.go
+0
-0
paracross.proto
plugin/dapp/paracross/proto/paracross.proto
+25
-0
paracross.go
plugin/dapp/paracross/types/paracross.go
+4
-0
type.go
plugin/dapp/paracross/types/type.go
+3
-0
No files found.
chain33.para.toml
View file @
1239ea28
...
...
@@ -85,8 +85,14 @@ maxTxNumber = 1600
[mver.consensus.paracross]
#超级节点挖矿奖励
coinReward
=
18
#发展基金奖励
coinDevFund
=
12
#如果超级节点上绑定了委托账户,则奖励超级节点coinBaseReward,其余部分(coinReward-coinBaseReward)按权重分给委托账户
coinBaseReward
=
5
#委托账户最少解绑定时间(按小时)
unBindTime
=
24
[consensus.sub.para]
...
...
plugin/dapp/paracross/executor/action.go
View file @
1239ea28
...
...
@@ -300,6 +300,15 @@ func (a *action) getNodesGroup(title string) (map[string]struct{}, []string, err
}
func
(
a
*
action
)
isValidSuperNode
(
addr
string
)
(
bool
,
error
)
{
cfg
:=
a
.
api
.
GetConfig
()
nodes
,
_
,
err
:=
getParacrossNodes
(
a
.
db
,
cfg
.
GetTitle
())
if
err
!=
nil
{
return
false
,
errors
.
Wrapf
(
err
,
"getNodes for title:%s"
,
cfg
.
GetTitle
())
}
return
validNode
(
addr
,
nodes
),
nil
}
//相同的BlockHash,只保留一份数据
func
updateCommitBlockHashs
(
stat
*
pt
.
ParacrossHeightStatus
,
commit
*
pt
.
ParacrossNodeStatus
)
{
if
stat
.
BlockDetails
==
nil
{
...
...
plugin/dapp/paracross/executor/exec.go
View file @
1239ea28
...
...
@@ -119,3 +119,9 @@ func (e *Paracross) Exec_SelfStageConfig(payload *pt.ParaStageConfig, tx *types.
a
:=
newAction
(
e
,
tx
)
return
a
.
SelfStageConfig
(
payload
)
}
//Exec_ParaBindMiner node group config process
func
(
e
*
Paracross
)
Exec_ParaBindMiner
(
payload
*
pt
.
ParaBindMinerInfo
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
a
:=
newAction
(
e
,
tx
)
return
a
.
bindMiner
(
payload
)
}
plugin/dapp/paracross/executor/kv.go
View file @
1239ea28
...
...
@@ -35,6 +35,9 @@ var (
paraSelfConsensStages
string
paraSelfConsensStageIDPrefix
string
paraBindMinderAddr
string
paraBindMinderNode
string
)
func
setPrefix
()
{
...
...
@@ -50,6 +53,10 @@ func setPrefix() {
paraSelfConsensStages
=
"mavl-paracross-selfconsens-stages-"
paraSelfConsensStageIDPrefix
=
"mavl-paracross-selfconsens-id-"
//bind miner
paraBindMinderAddr
=
"mavl-paracross-bindmineraddr-"
paraBindMinderNode
=
"mavl-paracross-bindminernode-"
localTx
=
"LODB-paracross-titleHeightAddr-"
localTitle
=
"LODB-paracross-title-"
localTitleHeight
=
"LODB-paracross-titleHeight-"
...
...
@@ -179,3 +186,16 @@ func calcLocalNodeGroupStatusPrefix(status int32) []byte {
func
calcLocalNodeGroupAllPrefix
()
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
localNodeGroupStatusTitle
))
}
//bind miner
func
calcParaBindMinerAddr
(
node
,
bind
string
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
paraBindMinderAddr
+
"%s-%s"
,
node
,
bind
))
}
func
calcParaBindMinerNode
(
node
string
)
[]
byte
{
return
[]
byte
(
paraBindMinderNode
+
node
)
}
func
calcParaBindMinerNodePrefix
()
[]
byte
{
return
[]
byte
(
paraBindMinderNode
)
}
plugin/dapp/paracross/executor/reward.go
View file @
1239ea28
This diff is collapsed.
Click to expand it.
plugin/dapp/paracross/proto/paracross.proto
View file @
1239ea28
...
...
@@ -158,6 +158,31 @@ message RespParacrossNodeGroups {
repeated
ParaNodeGroupStatus
ids
=
1
;
}
//para bind miner
message
ParaBindMinerInfo
{
string
addr
=
1
;
// miner addr
int32
bindStatus
=
2
;
// 0: init, 1: bind, 2:unbind
int64
bindCount
=
3
;
// bind coins count
int64
blockTime
=
4
;
// status bind block time
string
targetAddr
=
5
;
// super node addr
}
message
ReceiptParaBindMinerInfo
{
string
addr
=
1
;
// miner addr
ParaBindMinerInfo
prev
=
2
;
ParaBindMinerInfo
current
=
3
;
}
message
ParaNodeBindList
{
string
superNode
=
1
;
repeated
string
miners
=
2
;
}
message
ReceiptParaNodeBindListUpdate
{
ParaNodeBindList
prev
=
1
;
ParaNodeBindList
current
=
2
;
}
message
ParaBlock2MainMap
{
int64
height
=
1
;
string
blockHash
=
2
;
...
...
plugin/dapp/paracross/types/paracross.go
View file @
1239ea28
...
...
@@ -47,6 +47,8 @@ const (
TyLogParaStageGroupUpdate
=
667
//TyLogParaCrossAssetTransfer 统一的跨链资产转移
TyLogParaCrossAssetTransfer
=
670
TyLogParaBindMinerAddr
=
671
TyLogParaBindMinerNode
=
672
)
// action type
...
...
@@ -61,6 +63,8 @@ const (
ParacrossActionWithdraw
// ParacrossActionTransferToExec asset transfer to exec
ParacrossActionTransferToExec
// ParacrossActionParaBindMiner para chain bind super node miner
ParacrossActionParaBindMiner
)
const
(
...
...
plugin/dapp/paracross/types/type.go
View file @
1239ea28
...
...
@@ -109,6 +109,8 @@ func (p *ParacrossType) GetLogMap() map[int64]*types.LogInfo {
TyLogParaSelfConsStageConfig
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptSelfConsStageConfig
{}),
Name
:
"LogParaSelfConsStageConfig"
},
TyLogParaStageVoteDone
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptSelfConsStageVoteDone
{}),
Name
:
"LogParaSelfConfStageVoteDoen"
},
TyLogParaStageGroupUpdate
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptSelfConsStagesUpdate
{}),
Name
:
"LogParaSelfConfStagesUpdate"
},
TyLogParaBindMinerAddr
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaBindMinerInfo
{}),
Name
:
"TyLogParaBindMinerAddrUpdate"
},
TyLogParaBindMinerNode
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptParaNodeBindListUpdate
{}),
Name
:
"TyLogParaBindNodeListUpdate"
},
}
}
...
...
@@ -126,6 +128,7 @@ func (p *ParacrossType) GetTypeMap() map[string]int32 {
"NodeConfig"
:
ParacrossActionNodeConfig
,
"NodeGroupConfig"
:
ParacrossActionNodeGroupApply
,
"SelfStageConfig"
:
ParacrossActionSelfStageConfig
,
"ParaBindMiner"
:
ParacrossActionParaBindMiner
,
}
}
...
...
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