Skip to content

Commit 90bfa30

Browse files
committed
feat: transaction TTL support
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 2015cff commit 90bfa30

File tree

7 files changed

+30
-0
lines changed

7 files changed

+30
-0
lines changed

ledger/allegra.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ func (t AllegraTransaction) Fee() uint64 {
121121
return t.Body.Fee()
122122
}
123123

124+
func (t AllegraTransaction) TTL() uint64 {
125+
return t.Body.TTL()
126+
}
127+
124128
func (t AllegraTransaction) Metadata() *cbor.Value {
125129
return t.TxMetadata
126130
}

ledger/alonzo.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ func (t AlonzoTransaction) Fee() uint64 {
216216
return t.Body.Fee()
217217
}
218218

219+
func (t AlonzoTransaction) TTL() uint64 {
220+
return t.Body.TTL()
221+
}
222+
219223
func (t AlonzoTransaction) Metadata() *cbor.Value {
220224
return t.TxMetadata
221225
}

ledger/babbage.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,10 @@ func (t BabbageTransaction) Fee() uint64 {
338338
return t.Body.Fee()
339339
}
340340

341+
func (t BabbageTransaction) TTL() uint64 {
342+
return t.Body.TTL()
343+
}
344+
341345
func (t BabbageTransaction) Metadata() *cbor.Value {
342346
return t.TxMetadata
343347
}

ledger/byron.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ func (t *ByronTransaction) Fee() uint64 {
139139
return 0
140140
}
141141

142+
func (t *ByronTransaction) TTL() uint64 {
143+
// TODO
144+
return 0
145+
}
146+
142147
func (t *ByronTransaction) Metadata() *cbor.Value {
143148
return t.Attributes
144149
}

ledger/mary.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ func (t MaryTransaction) Fee() uint64 {
132132
return t.Body.Fee()
133133
}
134134

135+
func (t MaryTransaction) TTL() uint64 {
136+
return t.Body.TTL()
137+
}
138+
135139
func (t MaryTransaction) Metadata() *cbor.Value {
136140
return t.TxMetadata
137141
}

ledger/shelley.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ func (b *ShelleyTransactionBody) Fee() uint64 {
189189
return b.TxFee
190190
}
191191

192+
func (b *ShelleyTransactionBody) TTL() uint64 {
193+
return b.Ttl
194+
}
195+
192196
type ShelleyTransactionInput struct {
193197
cbor.StructAsArray
194198
TxId Blake2b256
@@ -273,6 +277,10 @@ func (t ShelleyTransaction) Fee() uint64 {
273277
return t.Body.Fee()
274278
}
275279

280+
func (t ShelleyTransaction) TTL() uint64 {
281+
return t.Body.TTL()
282+
}
283+
276284
func (t ShelleyTransaction) Metadata() *cbor.Value {
277285
return t.TxMetadata
278286
}

ledger/tx.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ type TransactionBody interface {
3333
Inputs() []TransactionInput
3434
Outputs() []TransactionOutput
3535
Fee() uint64
36+
TTL() uint64
3637
}
3738

3839
type TransactionInput interface {

0 commit comments

Comments
 (0)