Commit 2124418b authored by mdj33's avatar mdj33 Committed by vipwzw

add nonCommitTxcount

parent dae619a8
...@@ -34,7 +34,7 @@ const ( ...@@ -34,7 +34,7 @@ const (
addAct int64 = 1 //add para block action addAct int64 = 1 //add para block action
delAct int64 = 2 //reference blockstore.go, del para block action delAct int64 = 2 //reference blockstore.go, del para block action
minBlockNum = 6 //min block number startHeight before lastHeight in mainchain minBlockNum = 100 //min block number startHeight before lastHeight in mainchain
) )
var ( var (
......
...@@ -19,7 +19,7 @@ import ( ...@@ -19,7 +19,7 @@ import (
var ( var (
consensusInterval = 16 //about 1 new block interval consensusInterval = 16 //about 1 new block interval
minerInterval = 2 minerInterval = 5
) )
type commitMsgClient struct { type commitMsgClient struct {
...@@ -432,14 +432,14 @@ func (client *commitMsgClient) getNodeStatus(start, end int64) ([]*pt.ParacrossN ...@@ -432,14 +432,14 @@ func (client *commitMsgClient) getNodeStatus(start, end int64) ([]*pt.ParacrossN
var needSentTxs uint32 var needSentTxs uint32
for i := 0; i < int(count); i++ { for i := 0; i < int(count); i++ {
ret = append(ret, nodeList[req.Start+int64(i)]) ret = append(ret, nodeList[req.Start+int64(i)])
needSentTxs += nodeList[req.Start+int64(i)].TxCounts needSentTxs += nodeList[req.Start+int64(i)].NonCommitTxCounts
} }
//1.如果是只有commit tx的空块,推迟发送,直到等到一个完全没有commit tx的空块或者其他tx的块 //1.如果是只有commit tx的空块,推迟发送,直到等到一个完全没有commit tx的空块或者其他tx的块
//2,如果20个块都是 commit tx的空块,20个块打包一次发送,尽量减少commit tx造成的空块 //2,如果20个块都是 commit tx的空块,20个块打包一次发送,尽量减少commit tx造成的空块
//3,如果形如xxoxx的块排列,x代表commit空块,o代表实际的块,即只要不全部是commit块,也要全部打包一起发出去 //3,如果形如xxoxx的块排列,x代表commit空块,o代表实际的块,即只要不全部是commit块,也要全部打包一起发出去
//如果=0 意味着全部是paracross commit tx,延迟发送 //如果=0 意味着全部是paracross commit tx,延迟发送
if needSentTxs == 0 && count < types.TxGroupMaxCount { if needSentTxs == 0 && count < types.TxGroupMaxCount {
plog.Info("para commitmsg getNodeStatus all self consensus commit tx,send delay", "start", start, "end", end) plog.Debug("para commitmsg getNodeStatus all self consensus commit tx,send delay", "start", start, "end", end)
return nil, nil return nil, nil
} }
......
...@@ -154,6 +154,7 @@ tokenApprs = [ ...@@ -154,6 +154,7 @@ tokenApprs = [
] ]
[exec.sub.paracross] [exec.sub.paracross]
#平行链自共识停止n个块后,超级账户可以直接参与投票
paraConsensusStopBlocks=100 paraConsensusStopBlocks=100
[pprof] [pprof]
......
...@@ -185,10 +185,11 @@ func setMinerTxResultFork(status *pt.ParacrossNodeStatus, txs []*types.Transacti ...@@ -185,10 +185,11 @@ func setMinerTxResultFork(status *pt.ParacrossNodeStatus, txs []*types.Transacti
} }
} }
status.TxCounts = uint32(len(curTxHashs))
//有tx且全部是user.p.x.paracross的commit tx时候设为0 //有tx且全部是user.p.x.paracross的commit tx时候设为0
status.TxCounts = 1 status.NonCommitTxCounts = 1
if len(curTxHashs) != 0 && len(curTxHashs) == len(isCommitTx) { if len(curTxHashs) != 0 && len(curTxHashs) == len(isCommitTx) {
status.TxCounts = 0 status.NonCommitTxCounts = 0
} }
crossTxHashs := FilterParaCrossTxHashes(types.GetTitle(), txs) crossTxHashs := FilterParaCrossTxHashes(types.GetTitle(), txs)
......
...@@ -151,6 +151,7 @@ message ParacrossNodeStatus { ...@@ -151,6 +151,7 @@ message ParacrossNodeStatus {
repeated bytes txHashs = 11; repeated bytes txHashs = 11;
bytes crossTxResult = 12; bytes crossTxResult = 12;
repeated bytes crossTxHashs = 13; repeated bytes crossTxHashs = 13;
uint32 nonCommitTxCounts = 14;
} }
message ParacrossCommitAction { message ParacrossCommitAction {
......
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