Skip to content

Commit

Permalink
feat(dpos): generate block with sponsor tx
Browse files Browse the repository at this point in the history
  • Loading branch information
RainFallsSilent committed Jan 22, 2025
1 parent bbf89ab commit f8f236a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pow/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ func (pow *Service) GenerateBlock(minerAddr string,
}

msgBlock.Transactions = append(msgBlock.Transactions, coinBaseTx)
txCount := 1
totalTxsSize := coinBaseTx.GetSize()
totalTxFee := common.Fixed64(0)

if bestChain.Height+1 >= pow.chainParams.DPoSConfiguration.RecordSponsorStartHeight {
bestBlock, err := pow.chain.GetDposBlockByHash(*bestChain.Hash)
Expand All @@ -312,14 +315,12 @@ func (pow *Service) GenerateBlock(minerAddr string,
return nil, err
}
msgBlock.Transactions = append(msgBlock.Transactions, recordSponsorTx)
txCount++
totalTxsSize += recordSponsorTx.GetSize()
}
}

totalTxsSize := coinBaseTx.GetSize()
txCount := 1
totalTxFee := common.Fixed64(0)
txs := pow.txMemPool.GetTxsInPool()

isHighPriority := func(tx interfaces.Transaction) bool {
if tx.IsRevertToPOW() || tx.IsRevertToDPOS() ||
tx.IsIllegalTypeTx() || tx.IsInactiveArbitrators() ||
Expand All @@ -344,7 +345,6 @@ func (pow *Service) GenerateBlock(minerAddr string,

var proposalsUsedAmount common.Fixed64
for _, tx := range txs {

if tx.IsRecordSponorTx() {
continue
}
Expand Down

0 comments on commit f8f236a

Please sign in to comment.