Skip to content

Commit 3385495

Browse files
authored
Merge pull request #590 from moisesPompilio/issue-527
Fix CLN crash by waiting for block height sync before channel open
2 parents 775e0db + 948f289 commit 3385495

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/integration_tests_cln.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,17 @@ fn test_cln() {
6464
// Setup CLN
6565
let sock = "/tmp/lightning-rpc";
6666
let cln_client = LightningRPC::new(&sock);
67-
let cln_info = cln_client.getinfo().unwrap();
67+
let cln_info = {
68+
loop {
69+
let info = cln_client.getinfo().unwrap();
70+
// Wait for CLN to sync block height before channel open.
71+
// Prevents crash due to unset blockheight (see LDK Node issue #527).
72+
if info.blockheight > 0 {
73+
break info;
74+
}
75+
std::thread::sleep(std::time::Duration::from_millis(250));
76+
}
77+
};
6878
let cln_node_id = PublicKey::from_str(&cln_info.id).unwrap();
6979
let cln_address: SocketAddress = match cln_info.binding.first().unwrap() {
7080
NetworkAddress::Ipv4 { address, port } => {

0 commit comments

Comments
 (0)