test: ensure tests convert from BTC to SAT properly
This commit is a follow up to the prior commit which fixed a rounding error bug in lnwallet. For uniformity, we also fix other occurrences in the breach arbiter, as well as the integration tests.
This commit is contained in:
parent
af4afdb6f0
commit
4253b85309
@ -1255,7 +1255,11 @@ func createInitChannels(revocationWindow int) (*lnwallet.LightningChannel, *lnwa
|
|||||||
bobKeyPriv, bobKeyPub := btcec.PrivKeyFromBytes(btcec.S256(),
|
bobKeyPriv, bobKeyPub := btcec.PrivKeyFromBytes(btcec.S256(),
|
||||||
bobsPrivKey)
|
bobsPrivKey)
|
||||||
|
|
||||||
channelCapacity := btcutil.Amount(10 * 1e8)
|
channelCapacity, err := btcutil.NewAmount(10)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
channelBal := channelCapacity / 2
|
channelBal := channelCapacity / 2
|
||||||
aliceDustLimit := btcutil.Amount(200)
|
aliceDustLimit := btcutil.Amount(200)
|
||||||
bobDustLimit := btcutil.Amount(1300)
|
bobDustLimit := btcutil.Amount(1300)
|
||||||
|
@ -1418,7 +1418,7 @@ func testChannelForceClosure(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
t.Fatalf("unable to get carol's balance: %v", err)
|
t.Fatalf("unable to get carol's balance: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
carolStartingBalance := btcutil.Amount(carolBalResp.ConfirmedBalance * 1e8)
|
carolStartingBalance := carolBalResp.ConfirmedBalance
|
||||||
|
|
||||||
ctxt, _ := context.WithTimeout(ctxb, timeout)
|
ctxt, _ := context.WithTimeout(ctxb, timeout)
|
||||||
chanPoint := openChannelAndAssert(ctxt, t, net, net.Alice, carol,
|
chanPoint := openChannelAndAssert(ctxt, t, net, net.Alice, carol,
|
||||||
@ -1965,11 +1965,11 @@ func testChannelForceClosure(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to get carol's balance: %v", err)
|
t.Fatalf("unable to get carol's balance: %v", err)
|
||||||
}
|
}
|
||||||
carolExpectedBalance := carolStartingBalance + pushAmt
|
carolExpectedBalance := btcutil.Amount(carolStartingBalance) + pushAmt
|
||||||
if btcutil.Amount(carolBalResp.ConfirmedBalance*1e8) < carolExpectedBalance {
|
if btcutil.Amount(carolBalResp.ConfirmedBalance) < carolExpectedBalance {
|
||||||
t.Fatalf("carol's balance is incorrect: expected %v got %v",
|
t.Fatalf("carol's balance is incorrect: expected %v got %v",
|
||||||
carolExpectedBalance,
|
carolExpectedBalance,
|
||||||
btcutil.Amount(carolBalResp.ConfirmedBalance*1e8))
|
carolBalResp.ConfirmedBalance)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user