lnd test: calculate channel reserve based on balance before fees

This commit is contained in:
Johan T. Halseth 2018-02-22 11:14:41 +01:00
parent 24d30e6495
commit b9f09a666d
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26
1 changed files with 6 additions and 3 deletions

View File

@ -4635,8 +4635,9 @@ func testAsyncPayments(net *lntest.NetworkHarness, t *harnessTest) {
// amount of payments, between Alice and Bob, at the end of the test
// Alice should send all money from her side to Bob.
ctxt, _ := context.WithTimeout(ctxb, timeout)
channelCapacity := btcutil.Amount(paymentAmt * 2000)
chanPoint := openChannelAndAssert(ctxt, t, net, net.Alice, net.Bob,
paymentAmt*2000, 0)
channelCapacity, 0)
info, err := getChanInfo(net.Alice)
if err != nil {
@ -4645,8 +4646,10 @@ func testAsyncPayments(net *lntest.NetworkHarness, t *harnessTest) {
// Calculate the number of invoices. We will deplete the channel
// all the way down to the channel reserve.
chanReserve := info.LocalBalance / 100
numInvoices := int((info.LocalBalance - chanReserve) / paymentAmt)
chanReserve := channelCapacity / 100
availableBalance := btcutil.Amount(info.LocalBalance) - chanReserve
numInvoices := int(availableBalance / paymentAmt)
bobAmt := int64(numInvoices * paymentAmt)
aliceAmt := info.LocalBalance - bobAmt