-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo_test.go
42 lines (32 loc) · 1.27 KB
/
demo_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"testing"
"github.com/LightningPeach/starlight-demo-impl/demo"
"github.com/LightningPeach/starlight-demo-impl/tools"
)
func TestUnilateralClose(t *testing.T) {
hostAccount, guestAccount := demo.Setup()
channelProposeMsg, channelAcceptMsg := demo.OpenChannel(hostAccount, guestAccount)
rsn := tools.RoundSequenceNumber(hostAccount.BaseSequenceNumber, 1)
demo.UnilateralClose(hostAccount, channelProposeMsg, channelAcceptMsg, rsn)
}
func TestSimplePayment(t *testing.T) {
hostAccount, guestAccount := demo.Setup()
demo.OpenChannel(hostAccount, guestAccount)
rsn := tools.RoundSequenceNumber(hostAccount.BaseSequenceNumber, 1)
demo.SimplePayment(hostAccount, guestAccount, rsn)
}
func TestHtlcPayment_Timeout(t *testing.T) {
tools.HtlcMode = true
hostAccount, guestAccount := demo.Setup()
demo.OpenChannel(hostAccount, guestAccount)
rsn := tools.RoundSequenceNumber(hostAccount.BaseSequenceNumber, 1)
demo.HtlcPayment(hostAccount, guestAccount, rsn, true, false)
}
func TestHtlcPayment_Success(t *testing.T) {
tools.HtlcMode = true
hostAccount, guestAccount := demo.Setup()
demo.OpenChannel(hostAccount, guestAccount)
rsn := tools.RoundSequenceNumber(hostAccount.BaseSequenceNumber, 1)
demo.HtlcPayment(hostAccount, guestAccount, rsn, false, true)
}