Skip to content

Commit

Permalink
Give access to ConsesusParams
Browse files Browse the repository at this point in the history
  • Loading branch information
charithabandi authored and Yaiba committed Dec 11, 2024
1 parent 58b3dc4 commit 920ec25
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
20 changes: 20 additions & 0 deletions core/types/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,23 @@ type CommitRequest struct {
AppHash Hash
Syncing bool
}

type ConsensusParams struct {
// MaxBlockSize is the maximum size of a block in bytes.
MaxBlockSize int64
// JoinExpiry is the number of blocks after which the validators
// join request expires if not approved.
JoinExpiry int64
// VoteExpiry is the default number of blocks after which the validators
// vote expires if not approved.
VoteExpiry int64
// DisabledGasCosts dictates whether gas costs are disabled.
DisabledGasCosts bool

// MigrationStatus determines the status of the migration.
MigrationStatus MigrationStatus

// MaxVotesPerTx is the maximum number of votes that can be included in a
// single transaction.
MaxVotesPerTx int64
}
14 changes: 14 additions & 0 deletions node/block_processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,3 +523,17 @@ func (bp *BlockProcessor) AccountInfo(ctx context.Context, db sql.DB, identifier
func (bp *BlockProcessor) GetValidators() []*ktypes.Validator {
return bp.validators.GetValidators()
}

func (bp *BlockProcessor) ConsensusParams() *ktypes.ConsensusParams {
bp.mtx.Lock()
defer bp.mtx.Unlock()

return &ktypes.ConsensusParams{
MaxBlockSize: bp.chainCtx.NetworkParameters.MaxBlockSize,
JoinExpiry: bp.chainCtx.NetworkParameters.JoinExpiry,
VoteExpiry: bp.chainCtx.NetworkParameters.VoteExpiry,
DisabledGasCosts: bp.chainCtx.NetworkParameters.DisabledGasCosts,
MaxVotesPerTx: bp.chainCtx.NetworkParameters.MaxVotesPerTx,
MigrationStatus: bp.chainCtx.NetworkParameters.MigrationStatus,
}
}

0 comments on commit 920ec25

Please sign in to comment.