Skip to content

Commit 2653b02

Browse files
test: add is_splice_already_pending tests, bump rust-lightning rev
Update to afe7b5bb0 which includes splice unit tests.
1 parent 8565113 commit 2653b02

2 files changed

Lines changed: 40 additions & 12 deletions

File tree

Cargo.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ default = []
4242
# lightning-macros = { version = "0.2.0" }
4343

4444
# Branch: https://github.com/moneydevkit/rust-lightning/commits/feature/lsps4-splice-in/
45-
lightning = { git = "https://github.com/moneydevkit/rust-lightning", rev = "f6c56daa9", features = ["std"] }
46-
lightning-types = { git = "https://github.com/moneydevkit/rust-lightning", rev = "f6c56daa9" }
47-
lightning-invoice = { git = "https://github.com/moneydevkit/rust-lightning", rev = "f6c56daa9", features = ["std"] }
48-
lightning-net-tokio = { git = "https://github.com/moneydevkit/rust-lightning", rev = "f6c56daa9" }
49-
lightning-persister = { git = "https://github.com/moneydevkit/rust-lightning", rev = "f6c56daa9", features = ["tokio"] }
50-
lightning-background-processor = { git = "https://github.com/moneydevkit/rust-lightning", rev = "f6c56daa9" }
51-
lightning-rapid-gossip-sync = { git = "https://github.com/moneydevkit/rust-lightning", rev = "f6c56daa9" }
52-
lightning-block-sync = { git = "https://github.com/moneydevkit/rust-lightning", rev = "f6c56daa9", features = ["rest-client", "rpc-client", "tokio"] }
53-
lightning-transaction-sync = { git = "https://github.com/moneydevkit/rust-lightning", rev = "f6c56daa9", features = ["esplora-async-https", "time", "electrum-rustls-ring"] }
54-
lightning-liquidity = { git = "https://github.com/moneydevkit/rust-lightning", rev = "f6c56daa9", features = ["std"] }
55-
lightning-macros = { git = "https://github.com/moneydevkit/rust-lightning", rev = "f6c56daa9" }
45+
lightning = { git = "https://github.com/moneydevkit/rust-lightning", rev = "afe7b5bb0", features = ["std"] }
46+
lightning-types = { git = "https://github.com/moneydevkit/rust-lightning", rev = "afe7b5bb0" }
47+
lightning-invoice = { git = "https://github.com/moneydevkit/rust-lightning", rev = "afe7b5bb0", features = ["std"] }
48+
lightning-net-tokio = { git = "https://github.com/moneydevkit/rust-lightning", rev = "afe7b5bb0" }
49+
lightning-persister = { git = "https://github.com/moneydevkit/rust-lightning", rev = "afe7b5bb0", features = ["tokio"] }
50+
lightning-background-processor = { git = "https://github.com/moneydevkit/rust-lightning", rev = "afe7b5bb0" }
51+
lightning-rapid-gossip-sync = { git = "https://github.com/moneydevkit/rust-lightning", rev = "afe7b5bb0" }
52+
lightning-block-sync = { git = "https://github.com/moneydevkit/rust-lightning", rev = "afe7b5bb0", features = ["rest-client", "rpc-client", "tokio"] }
53+
lightning-transaction-sync = { git = "https://github.com/moneydevkit/rust-lightning", rev = "afe7b5bb0", features = ["esplora-async-https", "time", "electrum-rustls-ring"] }
54+
lightning-liquidity = { git = "https://github.com/moneydevkit/rust-lightning", rev = "afe7b5bb0", features = ["std"] }
55+
lightning-macros = { git = "https://github.com/moneydevkit/rust-lightning", rev = "afe7b5bb0" }
5656

5757
#lightning = { path = "../rust-lightning/lightning", features = ["std"] }
5858
#lightning-types = { path = "../rust-lightning/lightning-types" }
@@ -101,7 +101,7 @@ winapi = { version = "0.3", features = ["winbase"] }
101101
[dev-dependencies]
102102
# lightning = { version = "0.2.0", features = ["std", "_test_utils"] }
103103
# Branch: https://github.com/moneydevkit/rust-lightning/commits/lsp-0.2.0/
104-
lightning = { git = "https://github.com/moneydevkit/rust-lightning", rev = "f6c56daa9", features = ["std", "_test_utils"] }
104+
lightning = { git = "https://github.com/moneydevkit/rust-lightning", rev = "afe7b5bb0", features = ["std", "_test_utils"] }
105105
#lightning = { path = "../rust-lightning/lightning", features = ["std", "_test_utils"] }
106106
proptest = "1.0.0"
107107
regex = "1.5.6"

src/liquidity.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2315,3 +2315,31 @@ impl LSPS1Liquidity {
23152315
Ok(response)
23162316
}
23172317
}
2318+
2319+
#[cfg(test)]
2320+
mod tests {
2321+
use super::*;
2322+
2323+
#[test]
2324+
fn test_is_splice_already_pending() {
2325+
let pending_err = APIError::APIMisuseError {
2326+
err: "Channel abc cannot be spliced, as it has already a splice pending".to_string(),
2327+
};
2328+
assert!(is_splice_already_pending(&pending_err));
2329+
2330+
let other_err = APIError::APIMisuseError {
2331+
err: "Channel abc cannot be spliced as it is either pending open/close".to_string(),
2332+
};
2333+
assert!(!is_splice_already_pending(&other_err));
2334+
2335+
let zero_err = APIError::APIMisuseError {
2336+
err: "Channel abc cannot be spliced; contribution cannot be zero".to_string(),
2337+
};
2338+
assert!(!is_splice_already_pending(&zero_err));
2339+
2340+
let channel_unavailable = APIError::ChannelUnavailable {
2341+
err: "some error".to_string(),
2342+
};
2343+
assert!(!is_splice_already_pending(&channel_unavailable));
2344+
}
2345+
}

0 commit comments

Comments
 (0)