mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-05-23 02:00:02 +02:00
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
|
// amount of payments, between Alice and Bob, at the end of the test
|
||||||
// Alice should send all money from her side to Bob.
|
// Alice should send all money from her side to Bob.
|
||||||
ctxt, _ := context.WithTimeout(ctxb, timeout)
|
ctxt, _ := context.WithTimeout(ctxb, timeout)
|
||||||
|
channelCapacity := btcutil.Amount(paymentAmt * 2000)
|
||||||
chanPoint := openChannelAndAssert(ctxt, t, net, net.Alice, net.Bob,
|
chanPoint := openChannelAndAssert(ctxt, t, net, net.Alice, net.Bob,
|
||||||
paymentAmt*2000, 0)
|
channelCapacity, 0)
|
||||||
|
|
||||||
info, err := getChanInfo(net.Alice)
|
info, err := getChanInfo(net.Alice)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -4645,8 +4646,10 @@ func testAsyncPayments(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
|
|
||||||
// Calculate the number of invoices. We will deplete the channel
|
// Calculate the number of invoices. We will deplete the channel
|
||||||
// all the way down to the channel reserve.
|
// all the way down to the channel reserve.
|
||||||
chanReserve := info.LocalBalance / 100
|
chanReserve := channelCapacity / 100
|
||||||
numInvoices := int((info.LocalBalance - chanReserve) / paymentAmt)
|
availableBalance := btcutil.Amount(info.LocalBalance) - chanReserve
|
||||||
|
numInvoices := int(availableBalance / paymentAmt)
|
||||||
|
|
||||||
bobAmt := int64(numInvoices * paymentAmt)
|
bobAmt := int64(numInvoices * paymentAmt)
|
||||||
aliceAmt := info.LocalBalance - bobAmt
|
aliceAmt := info.LocalBalance - bobAmt
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user