Skip to content

Commit

Permalink
enforce non empty chainID on node app init
Browse files Browse the repository at this point in the history
  • Loading branch information
jordipainan committed Jan 9, 2024
1 parent b9beb0f commit 55148b7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions vochain/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,14 @@ func (app *BaseApplication) ChainID() string {

// SetChainID sets the app and state chainID
func (app *BaseApplication) SetChainID(chainID string) {
// A chain must have a chainID in order to be univocally identified.
// If the chainID is empty, panic here as it is the first part
// of the node app initialization.
// Stopping the execution at this point avoids carrying an invalid
// chainID in all subsequent operations.
if chainID == "" {
panic("chainID cannot be empty")
}
app.chainID = chainID
app.State.SetChainID(chainID)
}
Expand Down

0 comments on commit 55148b7

Please sign in to comment.