From b1a3c46759be0c5b1492c15a46bf81905e475a3e Mon Sep 17 00:00:00 2001 From: Matt Morehouse Date: Mon, 31 Jul 2023 09:52:33 -0500 Subject: [PATCH] htlcswitch: TODO for obviating type assertions memoryMailBox uses multiple container/list.List objects to track messages and packets, which use interface{} to accept objects of any type. go1.18 added generics to the language, which means we could use a typed list instead, allowing us to stop using forced type assertions when reading objects from the list. I'm not aware of any standard library implementation of a typed list yet, so let's just add a TODO for now. --- htlcswitch/mailbox.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htlcswitch/mailbox.go b/htlcswitch/mailbox.go index 8bc8ba6da..99066497c 100644 --- a/htlcswitch/mailbox.go +++ b/htlcswitch/mailbox.go @@ -112,6 +112,8 @@ type mailBoxConfig struct { // memoryMailBox is an implementation of the MailBox struct backed by purely // in-memory queues. +// +// TODO(morehouse): use typed lists instead of list.Lists to avoid type asserts. type memoryMailBox struct { started sync.Once stopped sync.Once