Skip to content

Commit eb3ca76

Browse files
committed
Revert "DROP VssHeaderProvier"
This reverts commit 651c95a.
1 parent 651c95a commit eb3ca76

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

bindings/ldk_node.udl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ interface Builder {
138138
Node build_with_vss_store(NodeEntropy node_entropy, string vss_url, string store_id, string lnurl_auth_server_url, record<string, string> fixed_headers);
139139
[Throws=BuildError]
140140
Node build_with_vss_store_and_fixed_headers(NodeEntropy node_entropy, string vss_url, string store_id, record<string, string> fixed_headers);
141+
[Throws=BuildError]
142+
Node build_with_vss_store_and_header_provider(NodeEntropy node_entropy, string vss_url, string store_id, VssHeaderProvider header_provider);
141143
};
142144

143145
interface Node {
@@ -398,6 +400,20 @@ enum BuildError {
398400
"AsyncPaymentsConfigMismatch",
399401
};
400402

403+
[Remote, Trait]
404+
interface VssHeaderProvider {
405+
[Async, Throws=VssHeaderProviderError]
406+
record<string, string> get_headers([ByRef]sequence<u8> request);
407+
};
408+
409+
[Remote, Error]
410+
enum VssHeaderProviderError {
411+
"InvalidData",
412+
"RequestError",
413+
"AuthorizationError",
414+
"InternalError",
415+
};
416+
401417
[Remote]
402418
enum PaymentFailureReason {
403419
"RecipientRejected",

src/builder.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,33 @@ impl ArcedNodeBuilder {
990990
.map(Arc::new)
991991
}
992992

993+
/// Builds a [`Node`] instance with a [VSS] backend and according to the options
994+
/// previously configured.
995+
///
996+
/// Given `header_provider` is used to attach headers to every request made
997+
/// to VSS.
998+
///
999+
/// **Caution**: VSS support is in **alpha** and is considered experimental.
1000+
/// Using VSS (or any remote persistence) may cause LDK to panic if persistence failures are
1001+
/// unrecoverable, i.e., if they remain unresolved after internal retries are exhausted.
1002+
///
1003+
/// [VSS]: https://github.com/lightningdevkit/vss-server/blob/main/README.md
1004+
pub fn build_with_vss_store_and_header_provider(
1005+
&self, node_entropy: Arc<NodeEntropy>, vss_url: String, store_id: String,
1006+
header_provider: Arc<dyn VssHeaderProvider>,
1007+
) -> Result<Arc<Node>, BuildError> {
1008+
self.inner
1009+
.read()
1010+
.unwrap()
1011+
.build_with_vss_store_and_header_provider(
1012+
*node_entropy,
1013+
vss_url,
1014+
store_id,
1015+
header_provider,
1016+
)
1017+
.map(Arc::new)
1018+
}
1019+
9931020
/// Builds a [`Node`] instance according to the options previously configured.
9941021
// Note that the generics here don't actually work for Uniffi, but we don't currently expose
9951022
// this so its not needed.

src/ffi/types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ pub use lightning_liquidity::lsps1::msgs::{
4141
};
4242
pub use lightning_types::payment::{PaymentHash, PaymentPreimage, PaymentSecret};
4343
pub use lightning_types::string::UntrustedString;
44+
pub use vss_client::headers::{VssHeaderProvider, VssHeaderProviderError};
4445

4546
use crate::builder::sanitize_alias;
4647
pub use crate::config::{

0 commit comments

Comments
 (0)