breacharbiter_test: utilize update channel state transition APIs
This commit is contained in:
parent
02c65db0d1
commit
aeecb9cdf5
@ -970,7 +970,7 @@ func TestBreachHandoffSuccess(t *testing.T) {
|
|||||||
// Send one HTLC to Bob and perform a state transition to lock it in.
|
// Send one HTLC to Bob and perform a state transition to lock it in.
|
||||||
htlcAmount := lnwire.NewMSatFromSatoshis(20000)
|
htlcAmount := lnwire.NewMSatFromSatoshis(20000)
|
||||||
htlc, _ := createHTLC(0, htlcAmount)
|
htlc, _ := createHTLC(0, htlcAmount)
|
||||||
if _, err := alice.AddHTLC(htlc); err != nil {
|
if _, err := alice.AddHTLC(htlc, nil); err != nil {
|
||||||
t.Fatalf("alice unable to add htlc: %v", err)
|
t.Fatalf("alice unable to add htlc: %v", err)
|
||||||
}
|
}
|
||||||
if _, err := bob.ReceiveHTLC(htlc); err != nil {
|
if _, err := bob.ReceiveHTLC(htlc); err != nil {
|
||||||
@ -990,7 +990,7 @@ func TestBreachHandoffSuccess(t *testing.T) {
|
|||||||
// Now send another HTLC and perform a state transition, this ensures
|
// Now send another HTLC and perform a state transition, this ensures
|
||||||
// Alice is ahead of the state Bob will broadcast.
|
// Alice is ahead of the state Bob will broadcast.
|
||||||
htlc2, _ := createHTLC(1, htlcAmount)
|
htlc2, _ := createHTLC(1, htlcAmount)
|
||||||
if _, err := alice.AddHTLC(htlc2); err != nil {
|
if _, err := alice.AddHTLC(htlc2, nil); err != nil {
|
||||||
t.Fatalf("alice unable to add htlc: %v", err)
|
t.Fatalf("alice unable to add htlc: %v", err)
|
||||||
}
|
}
|
||||||
if _, err := bob.ReceiveHTLC(htlc2); err != nil {
|
if _, err := bob.ReceiveHTLC(htlc2); err != nil {
|
||||||
@ -1058,7 +1058,7 @@ func TestBreachHandoffFail(t *testing.T) {
|
|||||||
// Send one HTLC to Bob and perform a state transition to lock it in.
|
// Send one HTLC to Bob and perform a state transition to lock it in.
|
||||||
htlcAmount := lnwire.NewMSatFromSatoshis(20000)
|
htlcAmount := lnwire.NewMSatFromSatoshis(20000)
|
||||||
htlc, _ := createHTLC(0, htlcAmount)
|
htlc, _ := createHTLC(0, htlcAmount)
|
||||||
if _, err := alice.AddHTLC(htlc); err != nil {
|
if _, err := alice.AddHTLC(htlc, nil); err != nil {
|
||||||
t.Fatalf("alice unable to add htlc: %v", err)
|
t.Fatalf("alice unable to add htlc: %v", err)
|
||||||
}
|
}
|
||||||
if _, err := bob.ReceiveHTLC(htlc); err != nil {
|
if _, err := bob.ReceiveHTLC(htlc); err != nil {
|
||||||
@ -1078,7 +1078,7 @@ func TestBreachHandoffFail(t *testing.T) {
|
|||||||
// Now send another HTLC and perform a state transition, this ensures
|
// Now send another HTLC and perform a state transition, this ensures
|
||||||
// Alice is ahead of the state Bob will broadcast.
|
// Alice is ahead of the state Bob will broadcast.
|
||||||
htlc2, _ := createHTLC(1, htlcAmount)
|
htlc2, _ := createHTLC(1, htlcAmount)
|
||||||
if _, err := alice.AddHTLC(htlc2); err != nil {
|
if _, err := alice.AddHTLC(htlc2, nil); err != nil {
|
||||||
t.Fatalf("alice unable to add htlc: %v", err)
|
t.Fatalf("alice unable to add htlc: %v", err)
|
||||||
}
|
}
|
||||||
if _, err := bob.ReceiveHTLC(htlc2); err != nil {
|
if _, err := bob.ReceiveHTLC(htlc2); err != nil {
|
||||||
@ -1554,7 +1554,7 @@ func forceStateTransition(chanA, chanB *lnwallet.LightningChannel) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := chanA.ReceiveRevocation(bobRevocation); err != nil {
|
if _, _, _, err := chanA.ReceiveRevocation(bobRevocation); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := chanA.ReceiveNewCommitment(bobSig, bobHtlcSigs); err != nil {
|
if err := chanA.ReceiveNewCommitment(bobSig, bobHtlcSigs); err != nil {
|
||||||
@ -1565,7 +1565,7 @@ func forceStateTransition(chanA, chanB *lnwallet.LightningChannel) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := chanB.ReceiveRevocation(aliceRevocation); err != nil {
|
if _, _, _, err := chanB.ReceiveRevocation(aliceRevocation); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user