mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-26 01:33:02 +01:00
tlv: add Zero() method for OptionalRecordT
Most of the time with wire messages, we'll have the wrapped record, so this is useful when decoding into a blank instance of the record's value.
This commit is contained in:
parent
afde7162c6
commit
3dd01cdc78
@ -140,6 +140,11 @@ func (o *OptionalRecordT[T, V]) UnwrapOrErrV(err error) (V, error) {
|
||||
return inner.Val, nil
|
||||
}
|
||||
|
||||
// Zero returns a zero value of the record type.
|
||||
func (t *OptionalRecordT[T, V]) Zero() RecordT[T, V] {
|
||||
return ZeroRecordT[T, V]()
|
||||
}
|
||||
|
||||
// SomeRecordT creates a new OptionalRecordT type from a given RecordT type.
|
||||
func SomeRecordT[T TlvType, V any](record RecordT[T, V]) OptionalRecordT[T, V] {
|
||||
return OptionalRecordT[T, V]{
|
||||
|
Loading…
x
Reference in New Issue
Block a user