dashpay / dash

Dash - Reinventing Cryptocurrency
https://www.dash.org
MIT License
1.49k stars 1.2k forks source link

`dash-cli` doesn't respect `dash.conf`'s `rpcbind` #5459

Open coolaj86 opened 1 year ago

coolaj86 commented 1 year ago

Scenario

dash-cli getaddressbalance '{"addresses": ["Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]}'

dash.conf

[main]
rpcuser=alice
rpcpassword=youllgethacked
bind=10.11.5.101:9999
rpcbind=10.11.5.101:9998
rpcallowip=10.11.5.101/24
zmqpubrawtx=tcp://10.11.5.101:28332
zmqpubrawtxlock=tcp://10.11.5.101:28332
error: Could not connect to the server 127.0.0.1:9998

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

Yes, the server is running. Yes, it connects as expected when rpcbind=127.0.0.1:9998.

Bugs

Two weird things here:

  1. dash-cli doesn't know how to use the correct address for rpc
  2. dashd doesn't bind to localhost when binding somewhere else \ (I don't think I've had this problem with other network software)
UdjinM6 commented 1 year ago
  1. check dash-cli help
    $ dash-cli --help | grep rpcconnect -A1
    -rpcconnect=<ip>
       Send commands to node running on <ip> (default: 127.0.0.1)

    try

    dash-cli -rpcconnect=10.11.5.101:9998 getaddressbalance '{"addresses": ["Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]}'
  2. you need to specify all addresses you want to bind to when you choose not to use the default one dash.conf
    [main]
    rpcuser=alice
    rpcpassword=youllgethacked
    bind=10.11.5.101:9999
    rpcbind=10.11.5.101:9998
    rpcbind=127.0.0.1:9998 # <----- this
    rpcallowip=10.11.5.101/24
    zmqpubrawtx=tcp://10.11.5.101:28332
    zmqpubrawtxlock=tcp://10.11.5.101:28332
coolaj86 commented 1 year ago
  1. I call that a bug still. Unless rpcconnect is specified, it should respect the default value that's already set. Bonus: would be nice if the error message told the user about using rpcconnect.

  2. That would be good to have more clear in the docs:

Thanks.