Skip to content

Commit e43e4dc

Browse files
committed
fix: arc dropping public key
1 parent 08d7816 commit e43e4dc

File tree

2 files changed

+27
-21
lines changed

2 files changed

+27
-21
lines changed

example/integration_test/bolt11_test.dart

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,9 @@ void main() {
126126

127127
debugPrint("Opening channel from aliceNode to bobNode");
128128
final bobNodeId = await bobNode.nodeId();
129-
debugPrint("Bob's node ID: ${bobNodeId.toString()}");
130-
129+
final bobNodeIdString = bobNodeId.toString();
130+
debugPrint("Bob's node ID: ${bobNodeIdString}");
131+
131132
// Check if nodes can see each other
132133
final bobListeningAddresses = await bobNode.listeningAddresses();
133134
debugPrint("Bob's listening addresses: $bobListeningAddresses");
@@ -172,8 +173,8 @@ void main() {
172173
while (!channelReady && channelAttempts < maxChannelAttempts) {
173174
final channels = await aliceNode.listChannels();
174175
debugPrint("Alice has ${channels.length} channels");
175-
176-
final bobChannels = channels.where((e) => e.counterpartyNodeId.toString() == bobNodeId.toString()).toList();
176+
177+
final bobChannels = channels.where((e) => e.counterpartyNodeId.toString() == bobNodeIdString).toList();
177178

178179
debugPrint("Alice has ${bobChannels.length} channels with Bob");
179180

@@ -224,17 +225,17 @@ void main() {
224225
}
225226

226227
expect(
227-
(alicePeers.where((e) => e.nodeId.toString() == bobNodeId.toString())).toList().isNotEmpty,
228+
(alicePeers.where((e) => e.nodeId.toString() == bobNodeIdString).toList().isNotEmpty),
228229
equals(true));
229230

230231
// Generate more blocks to ensure channel is well-confirmed
231232
await regTestClient.generate(5, await aliceNodeAddress.asString());
232233
expect(
233234
(aliceChannels
234-
.where((e) => e.counterpartyNodeId.toString() == bobNodeId.toString()))
235+
.where((e) => e.counterpartyNodeId.toString() == bobNodeIdString)
235236
.where((f) => f.isUsable && f.isChannelReady)
236237
.toList() !=
237-
[],
238+
[]),
238239
true);
239240

240241
// BOLT11 Payment Tests
@@ -318,7 +319,7 @@ void main() {
318319
// Cleanup
319320
debugPrint("Closing channel between Alice and Bob");
320321
await aliceNode.closeChannel(
321-
counterpartyNodeId: bobNodeId, userChannelId: userChannelId);
322+
counterpartyNodeId: await bobNode.nodeId(), userChannelId: userChannelId);
322323

323324
// Stop nodes with timeout to prevent hanging
324325
try {

example/integration_test/bolt12_test.dart

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void main() {
4040
}
4141

4242
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
43-
group('bolt11_integration', () {
43+
group('bolt12_integration', () {
4444
setUp(() async {});
4545
testWidgets('full_cycle', (WidgetTester tester) async {
4646
// Initialize flutter_rust_bridge
@@ -133,6 +133,7 @@ void main() {
133133
debugPrint("Opening channel from aliceNode to bobNode");
134134
final bobNodeId = await bobNode.nodeId();
135135
debugPrint("Bob's node ID: ${bobNodeId.toString()}");
136+
final bobNodeIdString = (await bobNode.nodeId()).toString();
136137

137138
// Check if nodes can see each other
138139
final bobListeningAddresses = await bobNode.listeningAddresses();
@@ -179,7 +180,7 @@ void main() {
179180
final channels = await aliceNode.listChannels();
180181
debugPrint("Alice has ${channels.length} channels");
181182

182-
final bobChannels = channels.where((e) => e.counterpartyNodeId.toString() == bobNodeId.toString()).toList();
183+
final bobChannels = channels.where((e) => e.counterpartyNodeId.toString() == bobNodeIdString).toList();
183184

184185
if (bobChannels.isNotEmpty) {
185186
final channel = bobChannels.first;
@@ -228,14 +229,14 @@ void main() {
228229
}
229230

230231
expect(
231-
(alicePeers.where((e) => e.nodeId.toString() == bobNodeId.toString())).toList().isNotEmpty,
232+
(alicePeers.where((e) => e.nodeId.toString() == bobNodeIdString).toList().isNotEmpty),
232233
equals(true));
233234

234235
// Generate more blocks to ensure channel is well-confirmed
235236
await regTestClient.generate(5, await aliceNodeAddress.asString());
236237
expect(
237238
(aliceChannels
238-
.where((e) => e.counterpartyNodeId.toString() == bobNodeId.toString()))
239+
.where((e) => e.counterpartyNodeId.toString() == bobNodeIdString))
239240
.where((f) => f.isUsable && f.isChannelReady)
240241
.toList() !=
241242
[],
@@ -276,22 +277,26 @@ void main() {
276277
debugPrint("Offer2 created, now sending payment of ${payment2ExpectedAmountMsat}msat");
277278
final payment2Id = await aliceNodeBol12Handler.sendUsingAmount(
278279
offer: offer2, amountMsat: BigInt.from(payment2ExpectedAmountMsat));
279-
debugPrint("payment_2 successful: ${payment2Id.toVec().toString()}");
280-
280+
final payment2IdVec = await payment2Id.toVec();
281+
debugPrint("payment_2 successful: ${payment2IdVec.toString()}");
282+
281283
// Wait a moment for the payment to be recorded
282284
await Future.delayed(const Duration(milliseconds: 500));
283285

284286
// Debug: List all payments from Alice
285287
final allAlicePayments = await aliceNode.listPayments();
286288
debugPrint("Alice now has ${allAlicePayments.length} total payments:");
287-
for (int i = 0; i < allAlicePayments.length; i++) {
288-
final payment = allAlicePayments[i];
289-
debugPrint(" Payment $i: ID=${payment.id.toVec()}, amount=${payment.amountMsat}msat, status=${payment.status}");
290-
}
289+
// for (int i = 0; i < allAlicePayments.length; i++) {
290+
// final payment = allAlicePayments[i];
291+
// debugPrint(" Payment $i:");
292+
// debugPrint(" ID: ${payment.id.toVec()}");
293+
// debugPrint(" Amount: ${payment.amountMsat}msat");
294+
// debugPrint(" Status: ${payment.status}");
295+
// }
291296

292297
// Check if payment2Id exists in the list
293-
final matchingPayments = allAlicePayments.where((e) => listEquals(e.id.toVec(), payment2Id.toVec())).toList();
294-
debugPrint("Looking for payment with ID: ${payment2Id.toVec()}");
298+
debugPrint("Looking for payment with ID: ${payment2IdVec}");
299+
final matchingPayments = allAlicePayments.where((e) => listEquals(e.id.toVec(), payment2IdVec)).toList();
295300
debugPrint("Found ${matchingPayments.length} matching payments");
296301

297302
if (matchingPayments.isEmpty) {
@@ -323,7 +328,7 @@ void main() {
323328
true);
324329
debugPrint("Bob's payment 3 found successfully");
325330
await aliceNode.closeChannel(
326-
counterpartyNodeId: bobNodeId, userChannelId: userChannelId);
331+
counterpartyNodeId: await bobNode.nodeId(), userChannelId: userChannelId);
327332
debugPrint("Closing channel between Alice and Bob");
328333

329334
// Stop nodes with timeout to prevent hanging

0 commit comments

Comments
 (0)