Skip to content

Commit 0b2aa02

Browse files
authored
feat:add Allegra protocol parameters support (#588)
Signed-off-by: Ales Verbic <[email protected]>
1 parent 7df13a3 commit 0b2aa02

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

ledger/allegra.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ func (h *AllegraBlockHeader) Era() Era {
114114

115115
type AllegraTransactionBody struct {
116116
ShelleyTransactionBody
117+
Update struct {
118+
cbor.StructAsArray
119+
ProtocolParamUpdates map[Blake2b224]AllegraProtocolParameterUpdate
120+
Epoch uint64
121+
} `cbor:"6,keyasint,omitempty"`
117122
ValidityIntervalStart uint64 `cbor:"8,keyasint,omitempty"`
118123
}
119124

@@ -191,6 +196,14 @@ func (t *AllegraTransaction) Cbor() []byte {
191196
return cborData
192197
}
193198

199+
type AllegraProtocolParameters struct {
200+
ShelleyProtocolParameters
201+
}
202+
203+
type AllegraProtocolParameterUpdate struct {
204+
ShelleyProtocolParameterUpdate
205+
}
206+
194207
func NewAllegraBlockFromCbor(data []byte) (*AllegraBlock, error) {
195208
var allegraBlock AllegraBlock
196209
if _, err := cbor.Decode(data, &allegraBlock); err != nil {

protocol/localstatequery/client.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,12 @@ func (c *Client) GetCurrentProtocolParams() (CurrentProtocolParamsResult, error)
354354
return nil, err
355355
}
356356
return result[0], nil
357+
case ledger.EraIdAllegra:
358+
result := []ledger.AllegraProtocolParameters{}
359+
if err := c.runQuery(query, &result); err != nil {
360+
return nil, err
361+
}
362+
return result[0], nil
357363
case ledger.EraIdShelley:
358364
result := []ledger.ShelleyProtocolParameters{}
359365
if err := c.runQuery(query, &result); err != nil {

0 commit comments

Comments
 (0)