Skip to content

Commit

Permalink
Merge pull request #403 from blinklabs-io/feat/transaction-ttl
Browse files Browse the repository at this point in the history
feat: transaction TTL support
  • Loading branch information
wolf31o2 authored Oct 17, 2023
2 parents 2015cff + 90bfa30 commit 59f0270
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ledger/allegra.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ func (t AllegraTransaction) Fee() uint64 {
return t.Body.Fee()
}

func (t AllegraTransaction) TTL() uint64 {
return t.Body.TTL()
}

func (t AllegraTransaction) Metadata() *cbor.Value {
return t.TxMetadata
}
Expand Down
4 changes: 4 additions & 0 deletions ledger/alonzo.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ func (t AlonzoTransaction) Fee() uint64 {
return t.Body.Fee()
}

func (t AlonzoTransaction) TTL() uint64 {
return t.Body.TTL()
}

func (t AlonzoTransaction) Metadata() *cbor.Value {
return t.TxMetadata
}
Expand Down
4 changes: 4 additions & 0 deletions ledger/babbage.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ func (t BabbageTransaction) Fee() uint64 {
return t.Body.Fee()
}

func (t BabbageTransaction) TTL() uint64 {
return t.Body.TTL()
}

func (t BabbageTransaction) Metadata() *cbor.Value {
return t.TxMetadata
}
Expand Down
5 changes: 5 additions & 0 deletions ledger/byron.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ func (t *ByronTransaction) Fee() uint64 {
return 0
}

func (t *ByronTransaction) TTL() uint64 {
// TODO
return 0
}

func (t *ByronTransaction) Metadata() *cbor.Value {
return t.Attributes
}
Expand Down
4 changes: 4 additions & 0 deletions ledger/mary.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ func (t MaryTransaction) Fee() uint64 {
return t.Body.Fee()
}

func (t MaryTransaction) TTL() uint64 {
return t.Body.TTL()
}

func (t MaryTransaction) Metadata() *cbor.Value {
return t.TxMetadata
}
Expand Down
8 changes: 8 additions & 0 deletions ledger/shelley.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ func (b *ShelleyTransactionBody) Fee() uint64 {
return b.TxFee
}

func (b *ShelleyTransactionBody) TTL() uint64 {
return b.Ttl
}

type ShelleyTransactionInput struct {
cbor.StructAsArray
TxId Blake2b256
Expand Down Expand Up @@ -273,6 +277,10 @@ func (t ShelleyTransaction) Fee() uint64 {
return t.Body.Fee()
}

func (t ShelleyTransaction) TTL() uint64 {
return t.Body.TTL()
}

func (t ShelleyTransaction) Metadata() *cbor.Value {
return t.TxMetadata
}
Expand Down
1 change: 1 addition & 0 deletions ledger/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type TransactionBody interface {
Inputs() []TransactionInput
Outputs() []TransactionOutput
Fee() uint64
TTL() uint64
}

type TransactionInput interface {
Expand Down

0 comments on commit 59f0270

Please sign in to comment.