Skip to content

Commit c66c0a0

Browse files
committed
Account for broadcast_transactions now taking an array of txs
1 parent a7b08c7 commit c66c0a0

File tree

4 files changed

+33
-27
lines changed

4 files changed

+33
-27
lines changed

ci/LDKSwift/Tests/LDKSwiftTests/HumanObjectPeerTestInstance.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,11 @@ public class HumanObjectPeerTestInstance {
173173
super.init()
174174
}
175175

176-
override func broadcastTransaction(tx: [UInt8]) {
177-
Task {
178-
await self.master.pendingBroadcastTracker.addTransaction(tx: tx)
176+
override func broadcastTransactions(txs: [[UInt8]]) {
177+
for tx in txs {
178+
Task {
179+
await self.master.pendingBroadcastTracker.addTransaction(tx: tx)
180+
}
179181
}
180182
}
181183
}

ci/LDKSwift/Tests/LDKSwiftTests/TestBroadcasterInterface.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import LDKHeaders
1212

1313
class TestBroadcasterInterface: BroadcasterInterface {
1414

15-
override func broadcastTransaction(tx: [UInt8]) {
15+
override func broadcastTransactions(txs: [[UInt8]]) {
1616
// insert code to broadcast transaction
1717
}
1818

xcode/LDKFramework/DirectlyLinkedBindingsApp/app-batteries/PolarIntegrationSample.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,15 +294,17 @@ public class PolarIntegrationSample {
294294
super.init()
295295
}
296296

297-
override func broadcastTransaction(tx: [UInt8]) {
298-
Task {
299-
try? await self.rpcInterface.submitTransaction(transaction: tx)
297+
override func broadcastTransactions(txs: [[UInt8]]) {
298+
for tx in txs {
299+
Task {
300+
try? await self.rpcInterface.submitTransaction(transaction: tx)
301+
}
300302
}
301303
}
302304
}
303305

304306
class MuteBroadcaster: BroadcasterInterface {
305-
override func broadcastTransaction(tx: [UInt8]) {
307+
override func broadcastTransactions(txs: [[UInt8]]) {
306308
// do nothing
307309
}
308310
}

xcode/LDKFramework/DirectlyLinkedBindingsApp/app-batteries/RegtestBroadcasterInterface.swift

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,31 @@ import Foundation
99

1010
class RegtestBroadcasterInterface: BroadcasterInterface {
1111

12-
override func broadcastTransaction(tx: [UInt8]) {
13-
14-
print("TX TO BROADCAST: \(tx)")
12+
override func broadcastTransactions(txs: [[UInt8]]) {
1513

14+
1615
let url = URL(string: "http://localhost:3000/api/lab/broadcast")!
1716

1817
var components = URLComponents(url: url, resolvingAgainstBaseURL: false)!
19-
20-
components.queryItems = [
21-
URLQueryItem(name: "tx", value: "\(tx)")
22-
]
23-
24-
let query = components.url!.query
25-
26-
var request = URLRequest(url: url)
27-
request.httpMethod = "POST"
28-
request.httpBody = Data(query!.utf8)
29-
30-
let session = URLSession(configuration: .default)
31-
let task = session.dataTask(with: request, completionHandler: { data, response, error in
32-
print("transaction broadcast result")
33-
})
34-
task.resume()
18+
19+
for tx in txs {
20+
print("TX TO BROADCAST: \(tx)")
21+
components.queryItems = [
22+
URLQueryItem(name: "tx", value: "\(tx)")
23+
]
24+
25+
let query = components.url!.query
26+
27+
var request = URLRequest(url: url)
28+
request.httpMethod = "POST"
29+
request.httpBody = Data(query!.utf8)
30+
31+
let session = URLSession(configuration: .default)
32+
let task = session.dataTask(with: request, completionHandler: { data, response, error in
33+
print("transaction broadcast result")
34+
})
35+
task.resume()
36+
}
3537
}
3638

3739
}

0 commit comments

Comments
 (0)