Commit 978fa4d4 authored by mdj33's avatar mdj33 Committed by vipwzw

super manager can pass by consens stop height

parent cdef5a14
......@@ -214,5 +214,6 @@ superManager=[
]
[exec.sub.paracross]
nodeGroupFrozenCoins=0
paraConsensusStopBlocks=100
......@@ -153,6 +153,8 @@ tokenApprs = [
"12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv",
]
[exec.sub.paracross]
paraConsensusStopBlocks=100
[pprof]
listenAddr = "localhost:6061"
......@@ -446,7 +446,7 @@ function para_cross_transfer_withdraw_for_token() {
done
}
function para_nodemanage_test() {
function para_nodemanage_node_join(){
echo "================# para node manage test ================="
balance=$(${CLI} account balance -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -e paracross | jq -r ".balance")
if [ "$balance" != "$PARA_COIN_FROZEN" ]; then
......@@ -472,6 +472,35 @@ function para_nodemanage_test() {
exit 1
fi
}
function para_nodemanage_quit_test(){
para_nodemanage_node_join
echo "=========== # para chain node quit ============="
hash=$(${PARA_CLI} send para node -o quit -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -k 0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588)
echo "${hash}"
query_tx "${PARA_CLI}" "${hash}"
balance=$(${CLI} account balance -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -e paracross | jq -r ".balance")
if [ "$balance" != "$PARA_COIN_FROZEN" ]; then
echo "unfrozen coinfrozen error balance=$balance"
exit 1
fi
status=$(${PARA_CLI} para node_status -t user.p.para. -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY | jq -r ".status")
if [ "${status}" != "4" ]; then
echo "wrong vote status"
${PARA_CLI} para node_status -t user.p.para. -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
exit 1
fi
}
function para_nodemanage_test() {
para_nodemanage_quit_test
para_nodemanage_node_join
echo "=========== # para chain node vote ============="
${PARA_CLI} send para node -o vote -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -v yes -k 0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b
${PARA_CLI} send para node -o vote -a 1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY -v yes -k 0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4
......
......@@ -329,9 +329,23 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
}
most, vote := getMostVote(stat)
if !isCommitDone(stat, nodes, most) {
//超级用户投yes票,就可以通过,防止当前所有授权节点都忘掉私钥场景
//超级用户且当前group里面有任一账户投yes票也可以通过是备选方案 (most >1)即可
if !(isSuperManager(a.fromaddr) && most > 0 && vote == pt.ParaNodeVoteYes) {
superManagerPass := false
if isSuperManager(a.fromaddr){
confStopBlocks := conf.GInt("paraConsensusStopBlocks")
data,err := a.exec.paracrossGetHeight(config.Title)
if err != nil{
clog.Info("paracross.nodeVote get consens height","err",err.Error())
return nil, err
}
consensHeight := data.(*pt.ParacrossStatus).Height
if a.exec.GetMainHeight() > consensHeight+confStopBlocks{
clog.Info("paracross.nodeVote, super manager pass","currHeight",a.height,"consensHeight",consensHeight,"confHeight",confStopBlocks)
superManagerPass = true
}
}
//超级用户投yes票,共识停止了一定高度就可以通过,防止当前所有授权节点都忘掉私钥场景
if !(superManagerPass && most > 0 && vote == pt.ParaNodeVoteYes) {
saveNodeAddr(a.db, key, stat)
return makeNodeConfigReceipt(a.fromaddr, config, &copyStat, stat), nil
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment