lnwallet: in TestForceClose properly assign Bob's balance

This commit is contained in:
Olaoluwa Osuntokun 2017-07-31 20:44:15 -07:00
parent 1b61341410
commit 00ca97c789
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -376,8 +376,8 @@ func calcStaticFee(numHTLCs int) btcutil.Amount {
btcutil.Amount(htlcWeight*numHTLCs)) / 1000 btcutil.Amount(htlcWeight*numHTLCs)) / 1000
} }
// createHTLC is a utility function for generating an HTLC with a given preimage // createHTLC is a utility function for generating an HTLC with a given
// and a given amount. // preimage and a given amount.
func createHTLC(data int, amount btcutil.Amount) (*lnwire.UpdateAddHTLC, [32]byte) { func createHTLC(data int, amount btcutil.Amount) (*lnwire.UpdateAddHTLC, [32]byte) {
preimage := bytes.Repeat([]byte{byte(data)}, 32) preimage := bytes.Repeat([]byte{byte(data)}, 32)
paymentHash := sha256.Sum256(preimage) paymentHash := sha256.Sum256(preimage)
@ -798,7 +798,7 @@ func TestForceClose(t *testing.T) {
htlcAmount := btcutil.Amount(500) htlcAmount := btcutil.Amount(500)
aliceAmount := aliceChannel.channelState.LocalBalance aliceAmount := aliceChannel.channelState.LocalBalance
bobAmount := bobChannel.channelState.RemoteBalance bobAmount := bobChannel.channelState.LocalBalance
closeSummary, err := aliceChannel.ForceClose() closeSummary, err := aliceChannel.ForceClose()
if err != nil { if err != nil {
@ -851,8 +851,8 @@ func TestForceClose(t *testing.T) {
if closeSummary.SelfOutputSignDesc.Output.Value != int64(bobAmount) { if closeSummary.SelfOutputSignDesc.Output.Value != int64(bobAmount) {
t.Fatalf("bob incorrect output value in SelfOutputSignDesc, "+ t.Fatalf("bob incorrect output value in SelfOutputSignDesc, "+
"expected %v, got %v", "expected %v, got %v",
bobChannel.channelState.LocalBalance, int64(bobAmount),
closeSummary.SelfOutputSignDesc.Output.Value) int64(closeSummary.SelfOutputSignDesc.Output.Value))
} }
if closeSummary.SelfOutputMaturity != if closeSummary.SelfOutputMaturity !=
uint32(bobChannel.channelState.LocalChanCfg.CsvDelay) { uint32(bobChannel.channelState.LocalChanCfg.CsvDelay) {