Skip to content

Commit

Permalink
push action
Browse files Browse the repository at this point in the history
  • Loading branch information
luomeiqin committed Dec 5, 2018
1 parent 303da02 commit 323f8b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion action/actor/producer/chain-agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func SetChainActorPid(tpid *actor.PID) {
}

// ApplyBlock is to receive and handle blocks
func ApplyBlock(block *types.Block) {
func AddBlock(block *types.Block) {
applyBlock := &message.InsertBlockReq{Block: block}
chainActorPid.Tell(applyBlock)
return
Expand Down
12 changes: 6 additions & 6 deletions action/actor/producer/producer-actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,15 @@ func (p *ProducerActor) working() uint32 {
p.db.Lock()
defer p.db.UnLock()
start := common.MeasureStart()
log.Infof("begin to producer block ")
p.pendingTxSession = p.db.GetSession()
if p.pendingTxSession != nil {
log.Infof("p.pendingTxSession need to reset ")
p.db.ResetSession()
}
log.Infof("begin session......... ")
p.pendingTxSession = p.db.BeginUndo(config.PRIMARY_TRX_SESSION)

trxs := GetAllPendingTrx()
log.Info("get trx times", common.Elapsed(start))
log.Debug("get trx times", common.Elapsed(start))
block := &types.Block{}
pendingBlockSize := uint32(unsafe.Sizeof(block))
coreStat, err := p.roleIntf.GetCoreState()
Expand All @@ -154,7 +152,7 @@ func (p *ProducerActor) working() uint32 {
applyStart := common.MeasureStart()
pass, _ := verifyTransactions(trx)
if pass == false {
log.Info("ApplyTransaction failed")
log.Error("PRODUCER verify transactions failed, trx %x", trx.Hash())
p.db.ResetSubSession()
removeTrx = append(removeTrx, trx)
continue
Expand Down Expand Up @@ -184,11 +182,13 @@ func (p *ProducerActor) working() uint32 {
if config.BtoConfig.Delegate.Solo == false {
ConsensusProducedBlock(block)
} else {
ApplyBlock(block)
AddBlock(block)
}

} else {
return config.PRODUCER_TIME_OUT
}
return p.ins.CalcNextReportTime()
return p.ins.CalcNextReportTime(block)
}
return config.PRODUCER_TIME_OUT
}

0 comments on commit 323f8b8

Please sign in to comment.