multi: move label validation to rpc and simplify validation function

Previously labels with reserved prefixes were added to provide us
with a way to identify automatically dispatched loops. This commit moves
the validation of these labels to the rpc level so that it will only
apply to user-initiated swaps.
This commit is contained in:
carla 2020-10-12 13:34:52 +02:00
parent 15a400b411
commit 7b56804bbe
No known key found for this signature in database
GPG key ID: 4CA7FE54A6213C91
5 changed files with 16 additions and 21 deletions

View file

@ -14,7 +14,6 @@ import (
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
"github.com/lightninglabs/lndclient"
"github.com/lightninglabs/loop/labels"
"github.com/lightninglabs/loop/loopdb"
"github.com/lightninglabs/loop/swap"
"github.com/lightningnetwork/lnd/chainntnfs"
@ -79,11 +78,6 @@ func newLoopInSwap(globalCtx context.Context, cfg *swapConfig,
currentHeight int32, request *LoopInRequest) (*loopInInitResult,
error) {
// Before we start, check that the label is valid.
if err := labels.Validate(request.Label); err != nil {
return nil, err
}
// Request current server loop in terms and use these to calculate the
// swap fee that we should subtract from the swap amount in the payment
// request that we send to the server.