mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 14:22:37 +01:00
tlv: add new Zero method on RecordT
In this commit, we add a new `Zero` method for the `RecordT` type. This method allows a caller to create the zero record for a type without needing to reference the actual TLV type. With this we go from this: ```go sig1 := tlv.ZeroRecordT[tlv.TlvType1, Sig]() ``` To this: ``` sig1 := c.CloserNoClosee.Zero() ```
This commit is contained in:
parent
47fced69da
commit
78e0e5ac5d
1 changed files with 5 additions and 0 deletions
|
@ -87,6 +87,11 @@ func (t *RecordT[T, V]) TlvType() Type {
|
|||
return t.recordType.TypeVal()
|
||||
}
|
||||
|
||||
// Zero returns a zero value of the record type.
|
||||
func (t *RecordT[T, V]) Zero() RecordT[T, V] {
|
||||
return ZeroRecordT[T, V]()
|
||||
}
|
||||
|
||||
// OptionalRecordT is a high-order type that represents an optional TLV record.
|
||||
// This can be used when a TLV record doesn't always need to be present (ok to
|
||||
// be odd).
|
||||
|
|
Loading…
Add table
Reference in a new issue