Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check that blocks without ceremonial txs go in a row #672

Merged
merged 2 commits into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions blockchain/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func NewBlockchain(config *config.Config, db dbm.DB, txpool *mempool.TxPool, app
indexer: newBlockchainIndexer(db, bus, config, keyStore),
subManager: subManager,
upgrader: upgrader,
ipfsLoadQueue: make(chan *attachments.StoreToIpfsAttachment, 100),
ipfsLoadQueue: make(chan *attachments.StoreToIpfsAttachment, 100),
}
}

Expand Down Expand Up @@ -783,6 +783,8 @@ func (chain *Blockchain) applyGlobalParams(appState *appstate.AppState, block *t
}
if !has {
appState.State.IncBlocksCntWithoutCeremonialTxs()
} else if chain.config.Consensus.ResetBlocksWithoutCeremonialTxs && appState.State.BlocksCntWithoutCeremonialTxs() > 0 {
appState.State.ResetBlocksCntWithoutCeremonialTxs()
}
}

Expand Down Expand Up @@ -1496,7 +1498,7 @@ func (chain *Blockchain) filterTxs(appState *appstate.AppState, txs []*types.Tra
if err := validation.ValidateTx(appState, tx, minFeePerGas, validation.InBlockTx); err != nil {
continue
}
if f, r, err := chain.ApplyTxOnState(appState, vm, tx, false,nil); err == nil {
if f, r, err := chain.ApplyTxOnState(appState, vm, tx, false, nil); err == nil {
gas := uint64(fee.CalculateGas(tx))
if r != nil {
receipts = append(receipts, r)
Expand Down Expand Up @@ -1635,7 +1637,7 @@ func (chain *Blockchain) validateBlock(checkState *appstate.AppState, block *typ
var err error
var receipts types.TxReceipts
var usedGas uint64
if totalFee, totalTips, receipts, usedGas, err = chain.processTxs(checkState, block, false,nil); err != nil {
if totalFee, totalTips, receipts, usedGas, err = chain.processTxs(checkState, block, false, nil); err != nil {
return err
}

Expand Down Expand Up @@ -2321,7 +2323,7 @@ func (chain *Blockchain) ipfsLoad() {
if err == nil {
c, _ := cid2.Cast(item.Cid)
chain.log.Debug("content loaded to local ipfs", "item", c.String())
} else{
} else {
chain.log.Debug("error while loading ipfs content", "err", err)
}
}
Expand Down
6 changes: 4 additions & 2 deletions config/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ type ConsensusConf struct {
DisableSavedInviteRewards bool
FixPoolRewardEvents bool
EnableStoreToIpfsTx bool
ResetBlocksWithoutCeremonialTxs bool
}

type ConsensusVerson uint16
Expand Down Expand Up @@ -136,11 +137,12 @@ func ApplyConsensusVersion(ver ConsensusVerson, cfg *ConsensusConf) {
case ConsensusV5:
cfg.FixPoolRewardEvents = true
cfg.EnableStoreToIpfsTx = true
cfg.ResetBlocksWithoutCeremonialTxs = true
cfg.Version = ConsensusV5
cfg.MigrationTimeout = 0
cfg.GenerateGenesisAfterUpgrade = true
cfg.StartActivationDate = time.Date(2021, 04, 20, 8, 0, 0, 0, time.UTC).Unix()
cfg.EndActivationDate = time.Date(2021, 04, 27, 0, 0, 0, 0, time.UTC).Unix()
cfg.StartActivationDate = time.Date(2021, 04, 27, 8, 0, 0, 0, time.UTC).Unix()
cfg.EndActivationDate = time.Date(2021, 05, 4, 0, 0, 0, 0, time.UTC).Unix()
}
}

Expand Down