lnd test: calculate channel reserve based on balance before fees
This commit is contained in:
parent
24d30e6495
commit
b9f09a666d
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user