Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use cookie_file instead of auth #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Kodylow
Copy link
Member

@Kodylow Kodylow commented Sep 26, 2024

Uses the generated cookie file by sharing the bitcoin_volume instead of the user/pass, needed for new bitcoin versions > 0.26.

Fedimint doesn't look like it's picking up the cookie file though which is weird, I'm definitely setting it correctly in the container:

}bash-5.2# echo $FM_BITCOIND_COOKIE_FILE_ENV
/bitcoind_data/.cookie
bash-5.2# cat /bitcoind_data/.cookie
__cookie__:c575d3ddde3a9439a0e0d113b07280887b769bf9cdfb0954f8de0c19898c3befbash-5.2# exit

and that should be getting picked up by the bitcoincore function:

pub fn from_url_to_url_auth(url: &SafeUrl) -> anyhow::Result<(String, Auth)> {
    Ok((
        (if let Some(port) = url.port() {
            format!(
                "{}://{}:{port}",
                url.scheme(),
                url.host_str().unwrap_or("127.0.0.1")
            )
        } else {
            format!(
                "{}://{}",
                url.scheme(),
                url.host_str().unwrap_or("127.0.0.1")
            )
        }),
        match (
            !url.username().is_empty(),
            env::var(FM_BITCOIND_COOKIE_FILE_ENV),
        ) {
            (true, Ok(_)) => {
                bail!("When {FM_BITCOIND_COOKIE_FILE_ENV} is set, the url auth part must be empty.")
            }
            (true, Err(_)) => Auth::UserPass(
                url.username().to_owned(),
                url.password()
                    .ok_or_else(|| format_err!("Password missing for {}", url.username()))?
                    .to_owned(),
            ),
            (false, Ok(path)) => Auth::CookieFile(PathBuf::from(path)),
            (false, Err(_)) => Auth::None,
        },
    ))
}

but whenever I try I get jsonrpc errors when fedimint tries starting the dkg

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.

1 participant