Skip to content
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
5 changes: 3 additions & 2 deletions ledger/conway/pparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ func (p *ConwayProtocolParameters) Update(
}
}

func (p *ConwayProtocolParameters) UpdateFromGenesis(genesis *ConwayGenesis) {
func (p *ConwayProtocolParameters) UpdateFromGenesis(genesis *ConwayGenesis) error {
if genesis == nil {
return
return nil
}
p.MinCommitteeSize = genesis.MinCommitteeSize
p.CommitteeTermLimit = genesis.CommitteeTermLimit
Expand Down Expand Up @@ -335,6 +335,7 @@ func (p *ConwayProtocolParameters) UpdateFromGenesis(genesis *ConwayGenesis) {
Rat: genesis.DRepVotingThresholds.TreasuryWithdrawal.Rat,
}
}
return nil
}

type ConwayProtocolParameterUpdate struct {
Expand Down
4 changes: 3 additions & 1 deletion ledger/conway/pparams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,9 @@ func TestConwayProtocolParamsUpdateFromGenesis(t *testing.T) {
t.Fatalf("unexpected error: %s", err)
}
tmpParams := testDef.startParams
tmpParams.UpdateFromGenesis(&tmpGenesis)
if err := tmpParams.UpdateFromGenesis(&tmpGenesis); err != nil {
t.Fatalf("unexpected error updating pparams from genesis: %s", err)
}
if !reflect.DeepEqual(tmpParams, testDef.expectedParams) {
t.Fatalf(
"did not get expected params:\n got: %#v\n wanted: %#v",
Expand Down
5 changes: 3 additions & 2 deletions ledger/shelley/pparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ func (p *ShelleyProtocolParameters) Update(
}
}

func (p *ShelleyProtocolParameters) UpdateFromGenesis(genesis *ShelleyGenesis) {
func (p *ShelleyProtocolParameters) UpdateFromGenesis(genesis *ShelleyGenesis) error {
if genesis == nil {
return
return nil
}
genesisParams := genesis.ProtocolParameters
p.MinFeeA = genesisParams.MinFeeA
Expand Down Expand Up @@ -130,6 +130,7 @@ func (p *ShelleyProtocolParameters) UpdateFromGenesis(genesis *ShelleyGenesis) {
p.ProtocolMajor = genesisParams.ProtocolVersion.Major
p.ProtocolMinor = genesisParams.ProtocolVersion.Minor
p.MinUtxoValue = genesisParams.MinUtxoValue
return nil
}

type ShelleyProtocolParameterUpdate struct {
Expand Down
4 changes: 3 additions & 1 deletion ledger/shelley/pparams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ func TestShelleyProtocolParamsUpdateFromGenesis(t *testing.T) {
t.Fatalf("unexpected error: %s", err)
}
tmpParams := testDef.startParams
tmpParams.UpdateFromGenesis(&tmpGenesis)
if err := tmpParams.UpdateFromGenesis(&tmpGenesis); err != nil {
t.Fatalf("unexpected error updating pparams from genesis: %s", err)
}
if !reflect.DeepEqual(tmpParams, testDef.expectedParams) {
t.Fatalf(
"did not get expected params:\n got: %#v\n wanted: %#v",
Expand Down
Loading