Skip to content

Commit a5e30a0

Browse files
authored
fix: check for nil TX pparam updates (#1078)
Fixes #1077 Signed-off-by: Aurora Gaffney <[email protected]>
1 parent 74ffef8 commit a5e30a0

File tree

6 files changed

+18
-0
lines changed

6 files changed

+18
-0
lines changed

ledger/allegra/allegra.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ func (b *AllegraTransactionBody) ValidityIntervalStart() uint64 {
203203
}
204204

205205
func (b *AllegraTransactionBody) ProtocolParameterUpdates() (uint64, map[common.Blake2b224]common.ProtocolParameterUpdate) {
206+
if b.Update == nil {
207+
return 0, nil
208+
}
206209
updateMap := make(map[common.Blake2b224]common.ProtocolParameterUpdate)
207210
for k, v := range b.Update.ProtocolParamUpdates {
208211
updateMap[k] = v

ledger/alonzo/alonzo.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ func (b *AlonzoTransactionBody) ValidityIntervalStart() uint64 {
217217
}
218218

219219
func (b *AlonzoTransactionBody) ProtocolParameterUpdates() (uint64, map[common.Blake2b224]common.ProtocolParameterUpdate) {
220+
if b.Update == nil {
221+
return 0, nil
222+
}
220223
updateMap := make(map[common.Blake2b224]common.ProtocolParameterUpdate)
221224
for k, v := range b.Update.ProtocolParamUpdates {
222225
updateMap[k] = v

ledger/babbage/babbage.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ func (b *BabbageTransactionBody) ValidityIntervalStart() uint64 {
293293
}
294294

295295
func (b *BabbageTransactionBody) ProtocolParameterUpdates() (uint64, map[common.Blake2b224]common.ProtocolParameterUpdate) {
296+
if b.Update == nil {
297+
return 0, nil
298+
}
296299
updateMap := make(map[common.Blake2b224]common.ProtocolParameterUpdate)
297300
for k, v := range b.Update.ProtocolParamUpdates {
298301
updateMap[k] = v

ledger/conway/conway.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,9 @@ func (b *ConwayTransactionBody) ValidityIntervalStart() uint64 {
402402
}
403403

404404
func (b *ConwayTransactionBody) ProtocolParameterUpdates() (uint64, map[common.Blake2b224]common.ProtocolParameterUpdate) {
405+
if b.Update == nil {
406+
return 0, nil
407+
}
405408
updateMap := make(map[common.Blake2b224]common.ProtocolParameterUpdate)
406409
for k, v := range b.Update.ProtocolParamUpdates {
407410
updateMap[k] = v

ledger/mary/mary.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ func (b *MaryTransactionBody) ValidityIntervalStart() uint64 {
205205
}
206206

207207
func (b *MaryTransactionBody) ProtocolParameterUpdates() (uint64, map[common.Blake2b224]common.ProtocolParameterUpdate) {
208+
if b.Update == nil {
209+
return 0, nil
210+
}
208211
updateMap := make(map[common.Blake2b224]common.ProtocolParameterUpdate)
209212
for k, v := range b.Update.ProtocolParamUpdates {
210213
updateMap[k] = v

ledger/shelley/shelley.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ func (b *ShelleyTransactionBody) TTL() uint64 {
261261
}
262262

263263
func (b *ShelleyTransactionBody) ProtocolParameterUpdates() (uint64, map[common.Blake2b224]common.ProtocolParameterUpdate) {
264+
if b.Update == nil {
265+
return 0, nil
266+
}
264267
updateMap := make(map[common.Blake2b224]common.ProtocolParameterUpdate)
265268
for k, v := range b.Update.ProtocolParamUpdates {
266269
updateMap[k] = v

0 commit comments

Comments
 (0)