test: update integration tests to account for base fees
In a recent commit, a default base fee of 1 satoshi has been added, as a result we now need to factor in the fees paid in a multi-hop setting.
This commit is contained in:
parent
b47ffde4ad
commit
a43b5658bb
18
lnd_test.go
18
lnd_test.go
@ -1191,6 +1191,11 @@ func testMultiHopPayments(net *networkHarness, t *harnessTest) {
|
|||||||
ctxt, _ := context.WithTimeout(ctxb, timeout)
|
ctxt, _ := context.WithTimeout(ctxb, timeout)
|
||||||
chanPointAlice := openChannelAndAssert(ctxt, t, net, net.Alice,
|
chanPointAlice := openChannelAndAssert(ctxt, t, net, net.Alice,
|
||||||
net.Bob, chanAmt, 0)
|
net.Bob, chanAmt, 0)
|
||||||
|
ctxt, _ = context.WithTimeout(ctxb, timeout)
|
||||||
|
err := net.Alice.WaitForNetworkChannelOpen(ctxt, chanPointAlice)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("alice didn't advertise her channel: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
aliceChanTXID, err := chainhash.NewHash(chanPointAlice.FundingTxid)
|
aliceChanTXID, err := chainhash.NewHash(chanPointAlice.FundingTxid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -1302,6 +1307,11 @@ func testMultiHopPayments(net *networkHarness, t *harnessTest) {
|
|||||||
case <-finClear:
|
case <-finClear:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When asserting the amount of satoshis moved, we'll factor in the
|
||||||
|
// default base fee, as we didn't modify the fee structure when
|
||||||
|
// creating the seed nodes in the network.
|
||||||
|
const baseFee = 1
|
||||||
|
|
||||||
assertAmountPaid := func(node *lightningNode,
|
assertAmountPaid := func(node *lightningNode,
|
||||||
chanPoint wire.OutPoint, amountSent,
|
chanPoint wire.OutPoint, amountSent,
|
||||||
amountReceived int64) {
|
amountReceived int64) {
|
||||||
@ -1334,7 +1344,7 @@ func testMultiHopPayments(net *networkHarness, t *harnessTest) {
|
|||||||
}
|
}
|
||||||
if channel.TotalSatoshisReceived !=
|
if channel.TotalSatoshisReceived !=
|
||||||
amountReceived {
|
amountReceived {
|
||||||
return fmt.Errorf("%v: inccrrect amount"+
|
return fmt.Errorf("%v: incorrect amount"+
|
||||||
" received: %v != %v",
|
" received: %v != %v",
|
||||||
channelName,
|
channelName,
|
||||||
channel.TotalSatoshisReceived,
|
channel.TotalSatoshisReceived,
|
||||||
@ -1378,8 +1388,10 @@ func testMultiHopPayments(net *networkHarness, t *harnessTest) {
|
|||||||
const amountPaid = int64(5000)
|
const amountPaid = int64(5000)
|
||||||
assertAmountPaid(net.Bob, aliceFundPoint, int64(0), amountPaid)
|
assertAmountPaid(net.Bob, aliceFundPoint, int64(0), amountPaid)
|
||||||
assertAmountPaid(net.Alice, aliceFundPoint, amountPaid, int64(0))
|
assertAmountPaid(net.Alice, aliceFundPoint, amountPaid, int64(0))
|
||||||
assertAmountPaid(net.Alice, carolFundPoint, int64(0), amountPaid)
|
assertAmountPaid(net.Alice, carolFundPoint, int64(0),
|
||||||
assertAmountPaid(carol, carolFundPoint, amountPaid, int64(0))
|
amountPaid+(baseFee*numPayments))
|
||||||
|
assertAmountPaid(carol, carolFundPoint, amountPaid+(baseFee*numPayments),
|
||||||
|
int64(0))
|
||||||
|
|
||||||
ctxt, _ = context.WithTimeout(ctxb, timeout)
|
ctxt, _ = context.WithTimeout(ctxb, timeout)
|
||||||
closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointAlice, false)
|
closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointAlice, false)
|
||||||
|
Loading…
Reference in New Issue
Block a user