diff --git a/cmd/voconed/voconed.go b/cmd/voconed/voconed.go index ec03430f6..2a6b0f7cf 100644 --- a/cmd/voconed/voconed.go +++ b/cmd/voconed/voconed.go @@ -193,7 +193,7 @@ func main() { if err != nil { log.Fatal(err) } - vc.SetChainID(config.chainID) + vc.App.SetChainID(config.chainID) log.Infof("using chainID: %s", config.chainID) // set treasurer address if provided diff --git a/vochain/genesis/genesis.go b/vochain/genesis/genesis.go index 20fb7abe1..776307b1a 100644 --- a/vochain/genesis/genesis.go +++ b/vochain/genesis/genesis.go @@ -39,8 +39,8 @@ var Genesis = map[string]Vochain{ } var devGenesis = Doc{ - GenesisTime: time.Date(2023, time.October, 10, 1, 0, 0, 0, time.UTC), - ChainID: "vocdoni-dev-24", + GenesisTime: time.Date(2023, time.October, 17, 1, 0, 0, 0, time.UTC), + ChainID: "vocdoni-dev-25", ConsensusParams: &ConsensusParams{ Block: BlockParams{ MaxBytes: 2097152, diff --git a/vochain/processid/process_id.go b/vochain/processid/process_id.go index 9f2cdd17d..a7831308b 100644 --- a/vochain/processid/process_id.go +++ b/vochain/processid/process_id.go @@ -102,12 +102,12 @@ func (p *ProcessID) String() string { } -// SetChainID sets the blockchain identifier +// SetChainID sets the process blockchain identifier func (p *ProcessID) SetChainID(chID string) { p.chainID = chID } -// ChainID returns blockchain identifier +// ChainID returns the process blockchain identifier func (p *ProcessID) ChainID() string { return p.chainID } @@ -181,6 +181,7 @@ func (p *ProcessID) EnvelopeType() *models.EnvelopeType { } } +// BuildProcessID returns a ProcessID constructed in a deterministic way func BuildProcessID(proc *models.Process, state *state.State) (*ProcessID, error) { pid := new(ProcessID) pid.SetChainID(state.ChainID()) diff --git a/vochain/start.go b/vochain/start.go index 3a12ecf39..c0e4ec04b 100644 --- a/vochain/start.go +++ b/vochain/start.go @@ -272,7 +272,7 @@ func newTendermint(app *BaseApplication, return nil, fmt.Errorf("cannot unmarshal genesis file for fetching chainID") } log.Infow("genesis file", "genesis", tconfig.GenesisFile(), "chainID", genesisCID.ChainID) - app.chainID = genesisCID.ChainID + app.SetChainID(genesisCID.ChainID) // assign the default tendermint methods app.SetDefaultMethods() diff --git a/vochain/state/state.go b/vochain/state/state.go index ab99765c6..edfb51af5 100644 --- a/vochain/state/state.go +++ b/vochain/state/state.go @@ -231,12 +231,12 @@ func (v *State) EventListeners() []EventListener { return v.eventListeners } -// SetChainID sets the blockchain identifier. +// SetChainID sets the state chainID (blockchain identifier) func (v *State) SetChainID(chID string) { v.chainID = chID } -// ChainID gets the blockchain identifier. +// ChainID gets the state chainID (blockchain identifier) func (v *State) ChainID() string { return v.chainID } diff --git a/vocone/vocone.go b/vocone/vocone.go index 12ad96a48..14d1417fc 100644 --- a/vocone/vocone.go +++ b/vocone/vocone.go @@ -512,11 +512,6 @@ func vochainPrintInfo(sleepSecs int64, vi *vochaininfo.VochainInfo) { } } -// SetChainID sets the chainID for the vocone instance -func (vc *Vocone) SetChainID(chainID string) { - vc.App.SetChainID(chainID) -} - func defaultTxCosts() genesis.TransactionCosts { return genesis.TransactionCosts{ SetProcessStatus: 1,