| 394 | } |
| 395 | |
| 396 | pub fn bitcoind_auth(&self) -> Result<RpcAuth> { |
| 397 | Ok(self.bitcoind_auth |
| 398 | .as_ref() |
| 399 | .and_then(|auth| { |
| 400 | let mut parts = auth.splitn(2, ':'); |
| 401 | Some(RpcAuth::UserPass(parts.next()?.into(), parts.next()?.into())) |
| 402 | }) |
| 403 | .or_else(|| { |
| 404 | let cookie = self.bitcoind_cookie.clone().or_else(|| get_cookie(self))?; |
| 405 | Some(RpcAuth::CookieFile(cookie)) |
| 406 | }) |
| 407 | .or_err("no valid authentication found for bitcoind rpc, specify user/pass or a cookie file")?) |
| 408 | } |
| 409 | |
| 410 | pub fn addresses(&self) -> Result<Vec<Address>> { |
| 411 | let mut addresses = self.addresses.clone(); |