HomePhabricator

Merge #12652: bitcoin-cli: Provide a better error message when bitcoind is not…

Description

Merge #12652: bitcoin-cli: Provide a better error message when bitcoind is not running

Summary:
8b2ef27 tests: Test connecting with non-existing RPC cookie file (practicalswift)
a2b2476 tests: Test connecting to a non-existing server (practicalswift)
de04fde bitcoin-cli: Provide a better error message when bitcoind is not running (practicalswift)

Pull request description:

Provide a better `bitcoin-cli` error message when `bitcoind` is not running.

Before this patch:

```
$ killall -9 bitcoind
$ bitcoin-cli -testnet echo 'hello world'
error: Could not locate RPC credentials. No authentication cookie could be found, and RPC password is not set.  See -rpcpassword and -stdinrpcpass.  Configuration file: (/root/.bitcoin/bitcoin.conf)
```

After this patch:

```
$ killall -9 bitcoind
$ bitcoin-cli -testnet echo 'hello world'
error: Could not connect to the server 127.0.0.1:18332

Make sure the bitcoind server is running and that you are connecting to the correct RPC port.
```

Tree-SHA512: bb16e1a9a1ac110ee202c3cb99b5d7c5c1e5487a17e6cd101e12dc69e9525c14dc71f37b128c26ad615369a57547f15d0f1e29b207c1b2f2ee4b4ba7105f3433

Backport of Core PR12652
https://github.com/bitcoin/bitcoin/pull/12652

Test Plan:

test_runner.py

./bitcoind
kill <bitcoind pid>
./bitcoin-cli <any rpc command>

This should output:
error: Could not connect to the server 127.0.0.1:18332

Make sure the bitcoind server is running and that you are connecting to the correct RPC port.

Reviewers: jasonbcox, deadalnix, Fabien, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D3355

Details

Provenance
Wladimir J. van der Laan <laanwj@gmail.com>Authored on Mar 20 2018, 08:36
nakihitoCommitted on Jun 17 2019, 23:27
jasonbcoxPushed on Jun 18 2019, 00:55
Reviewer
Restricted Owners Package
Differential Revision
D3355: Merge #12652: bitcoin-cli: Provide a better error message when bitcoind is not running
Parents
rSTAGINGf760e536af9a: Merge #10577: Add an explanation of quickly hashing onto a non-power of two…
Branches
Unknown
Tags
Unknown