@@ -15,7 +15,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
15
15
16
16
@RunWith(AndroidJUnit4 ::class )
17
17
class AndroidLibTest {
18
- @Test fun fullCycle () {
18
+ @Test fun node_start_stop () {
19
19
val network: Network = " regtest"
20
20
assertEquals(network, " regtest" )
21
21
@@ -51,106 +51,6 @@ class AndroidLibTest {
51
51
val address2 = node2.newFundingAddress()
52
52
println (" Funding address 2: $address2 " )
53
53
54
- // sendToAddress(address1, 100000u)
55
- // sendToAddress(address2, 100000u)
56
- // mine(6u)
57
- // Thread.sleep(5_000)
58
-
59
- // node1.syncWallets()
60
- // node2.syncWallets()
61
-
62
- // val spendableBalance1 = node1.spendableOnchainBalanceSats()
63
- // val spendableBalance2 = node2.spendableOnchainBalanceSats()
64
- // val totalBalance1 = node1.totalOnchainBalanceSats()
65
- // val totalBalance2 = node2.totalOnchainBalanceSats()
66
- // println("Spendable balance 1: $spendableBalance1")
67
- // println("Spendable balance 2: $spendableBalance1")
68
- // println("Total balance 1: $totalBalance1")
69
- // println("Total balance 2: $totalBalance1")
70
- // assertEquals(100000u, spendableBalance1)
71
- // assertEquals(100000u, spendableBalance2)
72
- // assertEquals(100000u, totalBalance1)
73
- // assertEquals(100000u, totalBalance2)
74
-
75
- // val idAndAddress2 = nodeId2 + "@" + listenAddress2
76
- // node1.connectOpenChannel(idAndAddress2, 50000u, true)
77
-
78
- // // Sleep a bit to allow for propagation
79
- // Thread.sleep(3_000)
80
-
81
- // mine(6u)
82
-
83
- // node1.syncWallets()
84
- // node2.syncWallets()
85
-
86
- // val spendableBalance1AfterOpen = node1.spendableOnchainBalanceSats()
87
- // val spendableBalance2AfterOpen = node2.spendableOnchainBalanceSats()
88
- // println("Spendable balance 1 after open: $spendableBalance1AfterOpen")
89
- // println("Spendable balance 2 after open: $spendableBalance2AfterOpen")
90
- // assert(spendableBalance1AfterOpen > 49000u)
91
- // assert(spendableBalance1AfterOpen < 50000u)
92
- // assertEquals(100000u, spendableBalance2AfterOpen)
93
-
94
- // val channelReadyEvent1 = node1.nextEvent()
95
- // println("Got event: $channelReadyEvent1")
96
- // assert(channelReadyEvent1 is Event.ChannelReady)
97
- // node1.eventHandled()
98
-
99
- // val channelReadyEvent2 = node2.nextEvent()
100
- // println("Got event: $channelReadyEvent2")
101
- // assert(channelReadyEvent2 is Event.ChannelReady)
102
- // node2.eventHandled()
103
-
104
- // val channelId = when (channelReadyEvent2) {
105
- // is Event.ChannelReady -> channelReadyEvent2.channelId
106
- // else -> return
107
- // }
108
-
109
- // val invoice = node2.receivePayment(1000000u, "asdf", 9217u)
110
-
111
- // node1.sendPayment(invoice)
112
-
113
- // val paymentSuccessfulEvent = node1.nextEvent()
114
- // println("Got event: $paymentSuccessfulEvent")
115
- // assert(paymentSuccessfulEvent is Event.PaymentSuccessful)
116
- // node1.eventHandled()
117
-
118
- // val paymentReceivedEvent = node2.nextEvent()
119
- // println("Got event: $paymentReceivedEvent")
120
- // assert(paymentReceivedEvent is Event.PaymentReceived)
121
- // node2.eventHandled()
122
-
123
- // node2.closeChannel(channelId, nodeId1)
124
-
125
- // // Sleep a bit to allow for propagation
126
- // Thread.sleep(3_000)
127
-
128
- // val channelClosedEvent1 = node1.nextEvent()
129
- // println("Got event: $channelClosedEvent1")
130
- // assert(channelClosedEvent1 is Event.ChannelClosed)
131
- // node1.eventHandled()
132
-
133
- // val channelClosedEvent2 = node2.nextEvent()
134
- // println("Got event: $channelClosedEvent2")
135
- // assert(channelClosedEvent2 is Event.ChannelClosed)
136
- // node2.eventHandled()
137
-
138
- // mine(1u)
139
-
140
- // // Sleep a bit to allow for propagation
141
- // Thread.sleep(3_000)
142
-
143
- // node1.syncWallets()
144
- // node2.syncWallets()
145
-
146
- // val spendableBalance1AfterClose = node1.spendableOnchainBalanceSats()
147
- // val spendableBalance2AfterClose = node2.spendableOnchainBalanceSats()
148
- // println("Spendable balance 1 after close: $spendableBalance1AfterClose")
149
- // println("Spendable balance 2 after close: $spendableBalance2AfterClose")
150
- // assert(spendableBalance1AfterClose > 95000u)
151
- // assert(spendableBalance1AfterClose < 100000u)
152
- // assertEquals(101000u, spendableBalance2AfterClose)
153
-
154
54
node1.stop()
155
55
node2.stop()
156
56
}
0 commit comments