Implement garbage collection or other mechanism to reduce memory bloat in Channel class
For understanding: this is meant to be sparse? A filecoin provider will expect to have a fair number of channels running with lots of micro-transactions in each.
Originally posted by @NiloCK in https://github.com/statechannels/go-nitro/pull/102#discussion_r767709020
Whenever we use a durable store, this issue extends beyond "memory bloat" to disk bloat.
We may also be able to save some additional space in the voucher store by e.g. not having the payer store the vouchers.
I'm going to close this for now as I don't think it's worth optimizing for disk space at this point.
Reopening as it is named under deliverable 1 of the grant https://github.com/filecoin-project/devgrants/issues/1508
A minimal improvement would be to delete channels when they are defunded.
Another easy improvement would be to only store the latest voucher (assuming we don't do so already).
More difficult: delete old states from ledger channels.
A minimal improvement would be to delete channels when they are defunded.
I think we can remove some data but we at least need to keep track off previous channel Ids we've used. Otherwise when receiving a message we don't know if it's a new channel or a stale message for a deleted channel. I think this could be dangerous as nitro node could be tricked to re-use the same channel id for a virtual channel, which would allow signed states from the defunded channel to be used against the "new" channel.
Yes I think you're right. Somewhat related to https://github.com/statechannels/go-nitro/issues/1116