multi: move and export funding-related vars to funding package
Also moves the lnd global MaxFundingAmount to server.go
This commit is contained in:
1 parent
f6524aabcb
commit
caa0f5da6a
11 files changed
+112
-101
No files matched your search
@@ -8,7 +8,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd"
|
||||
"github.com/lightningnetwork/lnd/funding"
|
||||
"github.com/lightningnetwork/lnd/lntest"
|
||||
)
|
||||
|
||||
@@ -49,7 +49,7 @@ func testMaxChannelSize(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
t.Fatalf("unable to connect peers: %v", err)
|
||||
}
|
||||
|
||||
chanAmt := lnd.MaxBtcFundingAmountWumbo + 1
|
||||
chanAmt := funding.MaxBtcFundingAmountWumbo + 1
|
||||
_, err = net.OpenChannel(
|
||||
ctxb, wumboNode, wumboNode2, lntest.OpenChannelParams{
|
||||
Amt: chanAmt,
|
||||
@@ -97,7 +97,7 @@ func testMaxChannelSize(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
// to accept our wumbo channel funding.
|
||||
wumboNode3, err := net.NewNode(
|
||||
"wumbo3", []string{"--protocol.wumbo-channels",
|
||||
fmt.Sprintf("--maxchansize=%v", int64(lnd.MaxBtcFundingAmountWumbo+1))},
|
||||
fmt.Sprintf("--maxchansize=%v", int64(funding.MaxBtcFundingAmountWumbo+1))},
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to create new node: %v", err)
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/lightningnetwork/lnd"
|
||||
"github.com/lightningnetwork/lnd/funding"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
|
||||
"github.com/lightningnetwork/lnd/lntest"
|
||||
@@ -19,7 +19,7 @@ func testHtlcErrorPropagation(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
// In this test we wish to exercise the daemon's correct parsing,
|
||||
// handling, and propagation of errors that occur while processing a
|
||||
// multi-hop payment.
|
||||
const chanAmt = lnd.MaxBtcFundingAmount
|
||||
const chanAmt = funding.MaxBtcFundingAmount
|
||||
|
||||
// First establish a channel with a capacity of 0.5 BTC between Alice
|
||||
// and Bob.
|
||||
@@ -102,7 +102,7 @@ func testHtlcErrorPropagation(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
t.Fatalf("unable to connect bob to carol: %v", err)
|
||||
}
|
||||
ctxt, _ = context.WithTimeout(ctxb, channelOpenTimeout)
|
||||
const bobChanAmt = lnd.MaxBtcFundingAmount
|
||||
const bobChanAmt = funding.MaxBtcFundingAmount
|
||||
chanPointBob := openChannelAndAssert(
|
||||
ctxt, t, net, net.Bob, carol,
|
||||
lntest.OpenChannelParams{
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd"
|
||||
"github.com/lightningnetwork/lnd/funding"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
"github.com/lightningnetwork/lnd/lnrpc/walletrpc"
|
||||
"github.com/lightningnetwork/lnd/lntest"
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
// multisig funding output.
|
||||
func testPsbtChanFunding(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
ctxb := context.Background()
|
||||
const chanSize = lnd.MaxBtcFundingAmount
|
||||
const chanSize = funding.MaxBtcFundingAmount
|
||||
|
||||
// First, we'll create two new nodes that we'll use to open channels
|
||||
// between for this test. Dave gets some coins that will be used to
|
||||
|
||||
+22
-21
@@ -32,6 +32,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd"
|
||||
"github.com/lightningnetwork/lnd/chainreg"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/funding"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/labels"
|
||||
"github.com/lightningnetwork/lnd/lncfg"
|
||||
@@ -1250,7 +1251,7 @@ func basicChannelFundingTest(t *harnessTest, net *lntest.NetworkHarness,
|
||||
alice *lntest.HarnessNode, bob *lntest.HarnessNode,
|
||||
fundingShim *lnrpc.FundingShim) (*lnrpc.Channel, *lnrpc.Channel, func(), error) {
|
||||
|
||||
chanAmt := lnd.MaxBtcFundingAmount
|
||||
chanAmt := funding.MaxBtcFundingAmount
|
||||
pushAmt := btcutil.Amount(100000)
|
||||
|
||||
// Record nodes' channel balance before testing.
|
||||
@@ -1493,7 +1494,7 @@ func testUnconfirmedChannelFunding(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
ctxb := context.Background()
|
||||
|
||||
const (
|
||||
chanAmt = lnd.MaxBtcFundingAmount
|
||||
chanAmt = funding.MaxBtcFundingAmount
|
||||
pushAmt = btcutil.Amount(100000)
|
||||
)
|
||||
|
||||
@@ -1945,7 +1946,7 @@ func testUpdateChannelPolicy(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
defaultTimeLockDelta = chainreg.DefaultBitcoinTimeLockDelta
|
||||
defaultMinHtlc = 1000
|
||||
)
|
||||
defaultMaxHtlc := calculateMaxHtlc(lnd.MaxBtcFundingAmount)
|
||||
defaultMaxHtlc := calculateMaxHtlc(funding.MaxBtcFundingAmount)
|
||||
|
||||
// Launch notification clients for all nodes, such that we can
|
||||
// get notified when they discover new channels and updates in the
|
||||
@@ -1955,7 +1956,7 @@ func testUpdateChannelPolicy(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
bobSub := subscribeGraphNotifications(t, ctxb, net.Bob)
|
||||
defer close(bobSub.quit)
|
||||
|
||||
chanAmt := lnd.MaxBtcFundingAmount
|
||||
chanAmt := funding.MaxBtcFundingAmount
|
||||
pushAmt := chanAmt / 2
|
||||
|
||||
// Create a channel Alice->Bob.
|
||||
@@ -2518,7 +2519,7 @@ func testOpenChannelAfterReorg(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
|
||||
// Create a new channel that requires 1 confs before it's considered
|
||||
// open, then broadcast the funding transaction
|
||||
chanAmt := lnd.MaxBtcFundingAmount
|
||||
chanAmt := funding.MaxBtcFundingAmount
|
||||
pushAmt := btcutil.Amount(0)
|
||||
ctxt, _ := context.WithTimeout(ctxb, channelOpenTimeout)
|
||||
pendingUpdate, err := net.OpenPendingChannel(ctxt, net.Alice, net.Bob,
|
||||
@@ -2738,7 +2739,7 @@ func testDisconnectingTargetPeer(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
t.Fatalf("unable to send coins to alice: %v", err)
|
||||
}
|
||||
|
||||
chanAmt := lnd.MaxBtcFundingAmount
|
||||
chanAmt := funding.MaxBtcFundingAmount
|
||||
pushAmt := btcutil.Amount(0)
|
||||
|
||||
// Create a new channel that requires 1 confs before it's considered
|
||||
@@ -2873,7 +2874,7 @@ func testDisconnectingTargetPeer(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
func testChannelFundingPersistence(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
ctxb := context.Background()
|
||||
|
||||
chanAmt := lnd.MaxBtcFundingAmount
|
||||
chanAmt := funding.MaxBtcFundingAmount
|
||||
pushAmt := btcutil.Amount(0)
|
||||
|
||||
// As we need to create a channel that requires more than 1
|
||||
@@ -3061,7 +3062,7 @@ func testChannelBalance(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
|
||||
// Open a channel with 0.16 BTC between Alice and Bob, ensuring the
|
||||
// channel has been opened properly.
|
||||
amount := lnd.MaxBtcFundingAmount
|
||||
amount := funding.MaxBtcFundingAmount
|
||||
|
||||
// Creates a helper closure to be used below which asserts the proper
|
||||
// response to a channel balance RPC.
|
||||
@@ -6169,7 +6170,7 @@ func testSendToRouteErrorPropagation(net *lntest.NetworkHarness, t *harnessTest)
|
||||
func testUnannouncedChannels(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
ctxb := context.Background()
|
||||
|
||||
amount := lnd.MaxBtcFundingAmount
|
||||
amount := funding.MaxBtcFundingAmount
|
||||
|
||||
// Open a channel between Alice and Bob, ensuring the
|
||||
// channel has been opened properly.
|
||||
@@ -7408,7 +7409,7 @@ func testBasicChannelCreationAndUpdates(net *lntest.NetworkHarness, t *harnessTe
|
||||
ctxb := context.Background()
|
||||
const (
|
||||
numChannels = 2
|
||||
amount = lnd.MaxBtcFundingAmount
|
||||
amount = funding.MaxBtcFundingAmount
|
||||
)
|
||||
|
||||
// Subscribe Bob and Alice to channel event notifications.
|
||||
@@ -7572,7 +7573,7 @@ func testMaxPendingChannels(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
ctxb := context.Background()
|
||||
|
||||
maxPendingChannels := lncfg.DefaultMaxPendingChannels + 1
|
||||
amount := lnd.MaxBtcFundingAmount
|
||||
amount := funding.MaxBtcFundingAmount
|
||||
|
||||
// Create a new node (Carol) with greater number of max pending
|
||||
// channels.
|
||||
@@ -8183,7 +8184,7 @@ func testRevokedCloseRetribution(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
ctxb := context.Background()
|
||||
|
||||
const (
|
||||
chanAmt = lnd.MaxBtcFundingAmount
|
||||
chanAmt = funding.MaxBtcFundingAmount
|
||||
paymentAmt = 10000
|
||||
numInvoices = 6
|
||||
)
|
||||
@@ -8452,7 +8453,7 @@ func testRevokedCloseRetributionZeroValueRemoteOutput(net *lntest.NetworkHarness
|
||||
ctxb := context.Background()
|
||||
|
||||
const (
|
||||
chanAmt = lnd.MaxBtcFundingAmount
|
||||
chanAmt = funding.MaxBtcFundingAmount
|
||||
paymentAmt = 10000
|
||||
numInvoices = 6
|
||||
)
|
||||
@@ -8701,7 +8702,7 @@ func testRevokedCloseRetributionRemoteHodl(net *lntest.NetworkHarness,
|
||||
ctxb := context.Background()
|
||||
|
||||
const (
|
||||
chanAmt = lnd.MaxBtcFundingAmount
|
||||
chanAmt = funding.MaxBtcFundingAmount
|
||||
pushAmt = 200000
|
||||
paymentAmt = 10000
|
||||
numInvoices = 6
|
||||
@@ -8747,7 +8748,7 @@ func testRevokedCloseRetributionRemoteHodl(net *lntest.NetworkHarness,
|
||||
|
||||
// In order to test Dave's response to an uncooperative channel closure
|
||||
// by Carol, we'll first open up a channel between them with a
|
||||
// lnd.MaxBtcFundingAmount (2^24) satoshis value.
|
||||
// funding.MaxBtcFundingAmount (2^24) satoshis value.
|
||||
ctxt, _ = context.WithTimeout(ctxb, channelOpenTimeout)
|
||||
chanPoint := openChannelAndAssert(
|
||||
ctxt, t, net, dave, carol,
|
||||
@@ -9165,7 +9166,7 @@ func testRevokedCloseRetributionAltruistWatchtowerCase(
|
||||
|
||||
ctxb := context.Background()
|
||||
const (
|
||||
chanAmt = lnd.MaxBtcFundingAmount
|
||||
chanAmt = funding.MaxBtcFundingAmount
|
||||
paymentAmt = 10000
|
||||
numInvoices = 6
|
||||
externalIP = "1.2.3.4"
|
||||
@@ -9739,7 +9740,7 @@ func assertDLPExecuted(net *lntest.NetworkHarness, t *harnessTest,
|
||||
func testDataLossProtection(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
ctxb := context.Background()
|
||||
const (
|
||||
chanAmt = lnd.MaxBtcFundingAmount
|
||||
chanAmt = funding.MaxBtcFundingAmount
|
||||
paymentAmt = 10000
|
||||
numInvoices = 6
|
||||
)
|
||||
@@ -10329,7 +10330,7 @@ func subscribeGraphNotifications(t *harnessTest, ctxb context.Context,
|
||||
func testGraphTopologyNotifications(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
ctxb := context.Background()
|
||||
|
||||
const chanAmt = lnd.MaxBtcFundingAmount
|
||||
const chanAmt = funding.MaxBtcFundingAmount
|
||||
|
||||
// Let Alice subscribe to graph notifications.
|
||||
graphSub := subscribeGraphNotifications(
|
||||
@@ -10656,7 +10657,7 @@ func testNodeAnnouncement(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
func testNodeSignVerify(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
ctxb := context.Background()
|
||||
|
||||
chanAmt := lnd.MaxBtcFundingAmount
|
||||
chanAmt := funding.MaxBtcFundingAmount
|
||||
pushAmt := btcutil.Amount(100000)
|
||||
|
||||
// Create a channel between alice and bob.
|
||||
@@ -13198,7 +13199,7 @@ func testAbandonChannel(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
|
||||
// First establish a channel between Alice and Bob.
|
||||
channelParam := lntest.OpenChannelParams{
|
||||
Amt: lnd.MaxBtcFundingAmount,
|
||||
Amt: funding.MaxBtcFundingAmount,
|
||||
PushAmt: btcutil.Amount(100000),
|
||||
}
|
||||
|
||||
@@ -13991,7 +13992,7 @@ func testExternalFundingChanPoint(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
// flow. To start with, we'll create a pending channel with a shim for
|
||||
// a transaction that will never be published.
|
||||
const thawHeight uint32 = 10
|
||||
const chanSize = lnd.MaxBtcFundingAmount
|
||||
const chanSize = funding.MaxBtcFundingAmount
|
||||
fundingShim1, chanPoint1, _ := deriveFundingShim(
|
||||
net, t, carol, dave, chanSize, thawHeight, 1, false,
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightningnetwork/lnd"
|
||||
"github.com/lightningnetwork/lnd/funding"
|
||||
"github.com/lightningnetwork/lnd/lntest"
|
||||
)
|
||||
|
||||
@@ -48,7 +48,7 @@ func testWumboChannels(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
t.Fatalf("unable to connect peers: %v", err)
|
||||
}
|
||||
|
||||
chanAmt := lnd.MaxBtcFundingAmount + 1
|
||||
chanAmt := funding.MaxBtcFundingAmount + 1
|
||||
_, err = net.OpenChannel(
|
||||
ctxb, wumboNode, miniNode, lntest.OpenChannelParams{
|
||||
Amt: chanAmt,
|
||||
|
||||
Reference in new issue
Block a user