Skip to content

Allow hostname RPC support#136

Open
Anyitechs wants to merge 1 commit intolightningdevkit:mainfrom
Anyitechs:split-rpc-addr
Open

Allow hostname RPC support#136
Anyitechs wants to merge 1 commit intolightningdevkit:mainfrom
Anyitechs:split-rpc-addr

Conversation

@Anyitechs
Copy link
Contributor

This splits the rpc_address configuration field into two fields, rpc_host and rpc_port to allow hostname support, especially in containerized environments.

Closes #66

@ldk-reviews-bot
Copy link

👋 Hi! Please choose at least one reviewer by assigning them on the right bar.
If no reviewers are assigned within 10 minutes, I'll automatically assign one.
Once the first reviewer has submitted a review, a second will be assigned if required.

Comment on lines -155 to +156
ChainSource::Rpc { rpc_address, rpc_user, rpc_password } => {
builder.set_chain_source_bitcoind_rpc(
rpc_address.ip().to_string(),
rpc_address.port(),
rpc_user,
rpc_password,
);
ChainSource::Rpc { rpc_host, rpc_port, rpc_user, rpc_password } => {
builder.set_chain_source_bitcoind_rpc(rpc_host, rpc_port, rpc_user, rpc_password);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up to you people to make the call, I'd prefer parsing a single <hostname>:<port> string rather than splitting that setting into two parameters. This is what I do in VSS, it optimizes for fewer config params. That setting is logically a single thing right?

Copy link
Contributor Author

@Anyitechs Anyitechs Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That setting is logically a single thing right?

I agree it is. The problem was that we parse this setting using SocketAddr and that has a limitation of only supporting IP addresses. In containerized environments where the IP address might change if the container restarts, the user will have to update this setting each time it restarts. But supporting hostname simplifies things, because you only have to map the setting to a hostname and not worry if/when the IP changes.

An alternative to using SocketAddr (without splitting) is the ToSocketAddrs trait which supports hostname but it's sync and blocking.

UPDATE:

Missed "I'd prefer parsing a single <hostname>:<port>" from the comment earlier. Will drop the split.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow hostname-based RPC communication (remove SocketAddr restriction)

3 participants