Skip to content

Commit 4cde25c

Browse files
committed
Fix cli conf: cookie and db
The cookie was set to an empty string by default, this caused a cryptic I/O error that took a while to track down. The db file path was set as .db by default, .gitignore assumes a .sled file.
1 parent 29388a1 commit 4cde25c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

payjoin-cli/example.config.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# --------------
77

88
# The path to the database file
9-
db_path = "payjoin.db"
9+
db_path = "payjoin.sled"
1010

1111
# The maximum fee rate that the receiver is willing to pay (in sat/vB)
1212
max_fee_rate = 2.0
@@ -29,7 +29,7 @@ rpchost = "http://localhost:18443/wallet/sender"
2929
# MacOS: ~/Library/Application Support/Bitcoin/<NETWORK>/.cookie
3030
# Windows Vista and later: C:\Users\YourUserName\AppData\Roaming\Bitcoin\<NETWORK>\.cookie
3131
# Windows XP: C:\Documents and Settings\YourUserName\Application Data\Bitcoin\<NETWORK>\.cookie
32-
cookie = ""
32+
# cookie = ""
3333

3434
# The rpcuser to connect to (specified in bitcoin.conf).
3535
rpcuser = "user"

payjoin-cli/src/app/wallet.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ pub struct BitcoindWallet {
2323
impl BitcoindWallet {
2424
pub fn new(config: &crate::app::config::BitcoindConfig) -> Result<Self> {
2525
let client = match &config.cookie {
26+
Some(cookie) if cookie.as_os_str().is_empty() =>
27+
return Err(anyhow!(
28+
"Cookie authentication enabled but no cookie path provided in config.toml"
29+
)),
2630
Some(cookie) => Client::new(config.rpchost.as_str(), Auth::CookieFile(cookie.into())),
2731
None => Client::new(
2832
config.rpchost.as_str(),

0 commit comments

Comments
 (0)