multi: add swap label to SwapContract and store under separate key

This commits adds an optional label to our swaps, and writes it to
disk under a separate key in our swap bucket. This approach is chosen
rather than an on-the-fly addition to our existing swap contract field
so that we do not need to deal with EOF checking in the future. To allow
creation of unique internal labels, we add a reserved prefix which can
be used by the daemon to set labels that are distinct from client set
ones.
This commit is contained in:
carla 2020-08-03 10:55:58 +02:00
parent e2c54bd052
commit 9678c7817d
No known key found for this signature in database
GPG key ID: 4CA7FE54A6213C91
9 changed files with 223 additions and 21 deletions

View file

@ -74,6 +74,9 @@ type OutRequest struct {
// Expiry is the absolute expiry height of the on-chain htlc.
Expiry int32
// Label contains an optional label for the swap.
Label string
}
// Out contains the full details of a loop out request. This includes things
@ -186,6 +189,9 @@ type LoopInRequest struct {
// ExternalHtlc specifies whether the htlc is published by an external
// source.
ExternalHtlc bool
// Label contains an optional label for the swap.
Label string
}
// LoopInTerms are the server terms on which it executes loop in swaps.