mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
loopdb: store outgoing channel set
Upgrade the database schema to allow for multiple outgoing channels. This is implemented as an on-the-fly migration leaving the old key in place.
This commit is contained in:
parent
044c1c12dd
commit
8c544bf2ba
9 changed files with 188 additions and 38 deletions
|
|
@ -3,6 +3,7 @@ package loop
|
|||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
|
@ -47,8 +48,11 @@ func TestLoopOutPaymentParameters(t *testing.T) {
|
|||
const maxParts = 5
|
||||
|
||||
// Initiate the swap.
|
||||
req := *testRequest
|
||||
req.OutgoingChanSet = loopdb.ChannelSet{2, 3}
|
||||
|
||||
swap, err := newLoopOutSwap(
|
||||
context.Background(), cfg, height, testRequest,
|
||||
context.Background(), cfg, height, &req,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
@ -99,6 +103,13 @@ func TestLoopOutPaymentParameters(t *testing.T) {
|
|||
maxParts, swapPayment.MaxParts)
|
||||
}
|
||||
|
||||
// Verify the outgoing channel set restriction.
|
||||
if !reflect.DeepEqual(
|
||||
[]uint64(req.OutgoingChanSet), swapPayment.OutgoingChanIds,
|
||||
) {
|
||||
t.Fatalf("Unexpected outgoing channel set")
|
||||
}
|
||||
|
||||
// Swap is expected to register for confirmation of the htlc. Assert
|
||||
// this to prevent a blocked channel in the mock.
|
||||
ctx.AssertRegisterConf()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue