Skip to content

Commit 4233460

Browse files
committed
add regtest async/await-based blockchain monitoring tooling with tests
1 parent 435c553 commit 4233460

File tree

6 files changed

+507
-13
lines changed

6 files changed

+507
-13
lines changed

xcode/DirectBindingsApp/DirectBindingsApp.xcodeproj/project.pbxproj

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/* Begin PBXBuildFile section */
1010
071041C427DA763F00AE1175 /* PolarConnectionExperiment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07C753E826D954B100081BF8 /* PolarConnectionExperiment.swift */; };
11-
074A2DC426D957BC00370D0B /* RegtestBlockchainObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07BBCB2826D0369F000D96C4 /* RegtestBlockchainObserver.swift */; };
11+
074A2DC426D957BC00370D0B /* RegtestBlockchainObserverOld.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07BBCB2826D0369F000D96C4 /* RegtestBlockchainObserverOld.swift */; };
1212
074A2DCD26D970D500370D0B /* RegtestBroadcasterInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 074A2DCB26D970D400370D0B /* RegtestBroadcasterInterface.swift */; };
1313
074A2DCE26D970D500370D0B /* RegtestChannelManagerPersister.swift in Sources */ = {isa = PBXBuildFile; fileRef = 074A2DCC26D970D500370D0B /* RegtestChannelManagerPersister.swift */; };
1414
075E22A226FEF8540000A76B /* NetGraphMsgHandlerConstructor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 075E22A126FEF8540000A76B /* NetGraphMsgHandlerConstructor.swift */; };
@@ -693,6 +693,8 @@
693693
076D251827FC219300970AFC /* InvoicePayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 076D227727FC219000970AFC /* InvoicePayer.swift */; };
694694
076D251927FC219300970AFC /* DelayedPaymentOutputDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 076D227827FC219000970AFC /* DelayedPaymentOutputDescriptor.swift */; };
695695
076D251A27FC219300970AFC /* DelayedPaymentOutputDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 076D227827FC219000970AFC /* DelayedPaymentOutputDescriptor.swift */; };
696+
076D2A6C280399F500970AFC /* RegtestBlockchainManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 076D2A6B280399F500970AFC /* RegtestBlockchainManager.swift */; };
697+
076D2A6E28039ACB00970AFC /* BlockchainObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 076D2A6D28039ACB00970AFC /* BlockchainObserver.swift */; };
696698
0780F9C7272865260095FD6A /* LNSyncHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0780F9C6272865260095FD6A /* LNSyncHandler.swift */; };
697699
07BBC76A26D02727000D96C4 /* DirectBindingsAppApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07BBC76926D02727000D96C4 /* DirectBindingsAppApp.swift */; };
698700
07BBC76C26D02727000D96C4 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07BBC76B26D02727000D96C4 /* ContentView.swift */; };
@@ -727,6 +729,8 @@
727729
07BBCE7726D03B49000D96C4 /* TestBroadcasterInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07BBCE6726D03B49000D96C4 /* TestBroadcasterInterface.swift */; };
728730
07C753E126D6BE4E00081BF8 /* HumanObjectPeerTestInstance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07C753DF26D6BE4E00081BF8 /* HumanObjectPeerTestInstance.swift */; };
729731
07C753F326D9560200081BF8 /* PromiseKit in Frameworks */ = {isa = PBXBuildFile; productRef = 07C753F226D9560200081BF8 /* PromiseKit */; };
732+
2DD11C86114C6827D6E338A2 /* BlockchainObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 076D2A6D28039ACB00970AFC /* BlockchainObserver.swift */; };
733+
2DD11F99CF6E547FA7FB9225 /* RegtestBlockchainManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 076D2A6B280399F500970AFC /* RegtestBlockchainManager.swift */; };
730734
/* End PBXBuildFile section */
731735

732736
/* Begin PBXContainerItemProxy section */
@@ -1092,6 +1096,8 @@
10921096
076D227627FC219000970AFC /* OutPoint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OutPoint.swift; sourceTree = "<group>"; };
10931097
076D227727FC219000970AFC /* InvoicePayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InvoicePayer.swift; sourceTree = "<group>"; };
10941098
076D227827FC219000970AFC /* DelayedPaymentOutputDescriptor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DelayedPaymentOutputDescriptor.swift; sourceTree = "<group>"; };
1099+
076D2A6B280399F500970AFC /* RegtestBlockchainManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegtestBlockchainManager.swift; sourceTree = "<group>"; };
1100+
076D2A6D28039ACB00970AFC /* BlockchainObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlockchainObserver.swift; sourceTree = "<group>"; };
10951101
0780F9C6272865260095FD6A /* LNSyncHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LNSyncHandler.swift; sourceTree = "<group>"; };
10961102
07BBC76626D02727000D96C4 /* DirectBindingsApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DirectBindingsApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
10971103
07BBC76926D02727000D96C4 /* DirectBindingsAppApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DirectBindingsAppApp.swift; sourceTree = "<group>"; };
@@ -1115,7 +1121,7 @@
11151121
07BBCB1826D034B1000D96C4 /* libldk.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libldk.a; sourceTree = "<group>"; };
11161122
07BBCB1A26D03571000D96C4 /* libresolv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.tbd; path = usr/lib/libresolv.tbd; sourceTree = SDKROOT; };
11171123
07BBCB2726D0369F000D96C4 /* SwiftSocketPeerHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftSocketPeerHandler.swift; sourceTree = "<group>"; };
1118-
07BBCB2826D0369F000D96C4 /* RegtestBlockchainObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RegtestBlockchainObserver.swift; sourceTree = "<group>"; };
1124+
07BBCB2826D0369F000D96C4 /* RegtestBlockchainObserverOld.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RegtestBlockchainObserverOld.swift; sourceTree = "<group>"; };
11191125
07BBCB2926D0369F000D96C4 /* SwiftSocketEchoHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftSocketEchoHandler.swift; sourceTree = "<group>"; };
11201126
07BBCB3426D036AC000D96C4 /* TCPPeerHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TCPPeerHandler.swift; sourceTree = "<group>"; };
11211127
07BBCB3526D036AC000D96C4 /* ChannelManagerConstructor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChannelManagerConstructor.swift; sourceTree = "<group>"; };
@@ -1652,9 +1658,11 @@
16521658
074A2DCB26D970D400370D0B /* RegtestBroadcasterInterface.swift */,
16531659
074A2DCC26D970D500370D0B /* RegtestChannelManagerPersister.swift */,
16541660
07BBCB2726D0369F000D96C4 /* SwiftSocketPeerHandler.swift */,
1655-
07BBCB2826D0369F000D96C4 /* RegtestBlockchainObserver.swift */,
1661+
07BBCB2826D0369F000D96C4 /* RegtestBlockchainObserverOld.swift */,
16561662
07BBCB2926D0369F000D96C4 /* SwiftSocketEchoHandler.swift */,
16571663
0780F9C6272865260095FD6A /* LNSyncHandler.swift */,
1664+
076D2A6D28039ACB00970AFC /* BlockchainObserver.swift */,
1665+
076D2A6B280399F500970AFC /* RegtestBlockchainManager.swift */,
16581666
);
16591667
path = "app-batteries";
16601668
sourceTree = "<group>";
@@ -1781,8 +1789,8 @@
17811789
);
17821790
mainGroup = 07BBC75D26D02727000D96C4;
17831791
packageReferences = (
1784-
07C753F126D9560200081BF8 /* XCRemoteSwiftPackageReference "PromiseKit" */,
1785-
076D1D2927F5163500970AFC /* XCRemoteSwiftPackageReference "swift-crypto" */,
1792+
07C753F126D9560200081BF8 /* XCRemoteSwiftPackageReference "PromiseKit.git" */,
1793+
076D1D2927F5163500970AFC /* XCRemoteSwiftPackageReference "swift-crypto.git" */,
17861794
);
17871795
productRefGroup = 07BBC76726D02727000D96C4 /* Products */;
17881796
projectDirPath = "";
@@ -1909,11 +1917,12 @@
19091917
076D23EB27FC219100970AFC /* Result_PositiveTimestampCreationErrorZ.swift in Sources */,
19101918
076D244927FC219200970AFC /* InvoiceFeatures.swift in Sources */,
19111919
076D23A127FC219100970AFC /* Result_COption_EventZDecodeErrorZ.swift in Sources */,
1920+
076D2A6E28039ACB00970AFC /* BlockchainObserver.swift in Sources */,
19121921
076D23DD27FC219100970AFC /* Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.swift in Sources */,
19131922
076D230127FC219000970AFC /* C2Tuple_SignatureSignatureZ.swift in Sources */,
19141923
076D22A327FC219000970AFC /* Option_u16Z.swift in Sources */,
19151924
076D24FB27FC219200970AFC /* LockedChannelMonitor.swift in Sources */,
1916-
074A2DC426D957BC00370D0B /* RegtestBlockchainObserver.swift in Sources */,
1925+
074A2DC426D957BC00370D0B /* RegtestBlockchainObserverOld.swift in Sources */,
19171926
076D231B27FC219000970AFC /* Result_ScorerDecodeErrorZ.swift in Sources */,
19181927
076D241327FC219100970AFC /* Result_ReplyShortChannelIdsEndDecodeErrorZ.swift in Sources */,
19191928
076D249D27FC219200970AFC /* HolderCommitmentTransaction.swift in Sources */,
@@ -2155,6 +2164,7 @@
21552164
076D22DF27FC219000970AFC /* Filter.swift in Sources */,
21562165
076D23EF27FC219100970AFC /* Result_NodeAnnouncementDecodeErrorZ.swift in Sources */,
21572166
076D23AB27FC219100970AFC /* Result_HTLCUpdateDecodeErrorZ.swift in Sources */,
2167+
076D2A6C280399F500970AFC /* RegtestBlockchainManager.swift in Sources */,
21582168
07BBCB1B26D03578000D96C4 /* ldk_net.c in Sources */,
21592169
076D245327FC219200970AFC /* BestBlock.swift in Sources */,
21602170
076D229D27FC219000970AFC /* Option_MonitorEventZ.swift in Sources */,
@@ -2547,6 +2557,8 @@
25472557
076D230C27FC219000970AFC /* C2Tuple_PaymentHashPaymentIdZ.swift in Sources */,
25482558
076D24C827FC219200970AFC /* ChannelDetails.swift in Sources */,
25492559
076D237227FC219100970AFC /* Result_NoneAPIErrorZ.swift in Sources */,
2560+
2DD11F99CF6E547FA7FB9225 /* RegtestBlockchainManager.swift in Sources */,
2561+
2DD11C86114C6827D6E338A2 /* BlockchainObserver.swift in Sources */,
25502562
);
25512563
runOnlyForDeploymentPostprocessing = 0;
25522564
};
@@ -2874,15 +2886,15 @@
28742886
/* End XCConfigurationList section */
28752887

28762888
/* Begin XCRemoteSwiftPackageReference section */
2877-
076D1D2927F5163500970AFC /* XCRemoteSwiftPackageReference "swift-crypto" */ = {
2889+
076D1D2927F5163500970AFC /* XCRemoteSwiftPackageReference "swift-crypto.git" */ = {
28782890
isa = XCRemoteSwiftPackageReference;
28792891
repositoryURL = "https://github.com/apple/swift-crypto.git";
28802892
requirement = {
28812893
kind = upToNextMajorVersion;
28822894
minimumVersion = 2.0.0;
28832895
};
28842896
};
2885-
07C753F126D9560200081BF8 /* XCRemoteSwiftPackageReference "PromiseKit" */ = {
2897+
07C753F126D9560200081BF8 /* XCRemoteSwiftPackageReference "PromiseKit.git" */ = {
28862898
isa = XCRemoteSwiftPackageReference;
28872899
repositoryURL = "https://github.com/mxcl/PromiseKit.git";
28882900
requirement = {
@@ -2895,12 +2907,12 @@
28952907
/* Begin XCSwiftPackageProductDependency section */
28962908
076D1D2A27F5163500970AFC /* Crypto */ = {
28972909
isa = XCSwiftPackageProductDependency;
2898-
package = 076D1D2927F5163500970AFC /* XCRemoteSwiftPackageReference "swift-crypto" */;
2910+
package = 076D1D2927F5163500970AFC /* XCRemoteSwiftPackageReference "swift-crypto.git" */;
28992911
productName = Crypto;
29002912
};
29012913
07C753F226D9560200081BF8 /* PromiseKit */ = {
29022914
isa = XCSwiftPackageProductDependency;
2903-
package = 07C753F126D9560200081BF8 /* XCRemoteSwiftPackageReference "PromiseKit" */;
2915+
package = 07C753F126D9560200081BF8 /* XCRemoteSwiftPackageReference "PromiseKit.git" */;
29042916
productName = PromiseKit;
29052917
};
29062918
/* End XCSwiftPackageProductDependency section */

xcode/DirectBindingsApp/DirectBindingsApp/PolarConnectionExperiment.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class PolarConnectionExperiment: ObservableObject {
2525
var keysManager: KeysManager
2626
var keysInterface: KeysInterface
2727

28-
var blockchainObserver: RegtestBlockchainObserver!
28+
var blockchainObserver: RegtestBlockchainObserverOld!
2929

3030
// reliant on async response from blockchain observer
3131
var channelManagerConstructor: ChannelManagerConstructor!
@@ -53,7 +53,7 @@ class PolarConnectionExperiment: ObservableObject {
5353

5454
self.keysInterface = self.keysManager.as_KeysInterface()
5555

56-
self.blockchainObserver = RegtestBlockchainObserver(listeners: [], chainTip: nil) {
56+
self.blockchainObserver = RegtestBlockchainObserverOld(listeners: [], chainTip: nil) {
5757
// sync complete
5858
let config = UserConfig()
5959
let lightningNetwork = LDKNetwork_Regtest

0 commit comments

Comments
 (0)