channeldb+lnwallet: add ShutdownInfo with read and write methods

ShutdownInfo contains any info about a previous Shutdown message that we
have sent. This commit adds this type along with read and write methods
for it in the channel db. The existence of the ShutdownInfo on disk
represents the fact that we have previously sent the Shutdown message
and hence that we should resend it on re-establish.
This commit is contained in:
Elle Mouton
2024-02-06 15:56:27 +02:00
parent 987604effb
commit dc25b425c0
5 changed files with 225 additions and 0 deletions

View File

@@ -35,6 +35,11 @@ type Channel interface { //nolint:interfacebloat
// transaction has been broadcast.
MarkCoopBroadcasted(*wire.MsgTx, bool) error
// MarkShutdownSent persists the given ShutdownInfo. The existence of
// the ShutdownInfo represents the fact that the Shutdown message has
// been sent by us and so should be re-sent on re-establish.
MarkShutdownSent(info *channeldb.ShutdownInfo) error
// IsInitiator returns true we are the initiator of the channel.
IsInitiator() bool