Why bitcoind does not respect rpcbind for testnet?

0

For some reason testnet does not respect bitcoin.conf RPC configuration:

admin@az-bitcoind:~$ sudo netstat -natp | grep 8332
tcp        0      0 10.18.0.1:8332          0.0.0.0:*               LISTEN      582/bitcoind        
tcp        0      0 127.0.0.1:8332          0.0.0.0:*               LISTEN      582/bitcoind        
tcp        0      0 127.0.0.1:18332         0.0.0.0:*               LISTEN      581/bitcoind        
tcp6       0      0 ::1:18332               :::*                    LISTEN      581/bitcoind        

Expected: bitcoind bound to 10.18.0.1:8332 and 10.18.0.1:18332 and 127.0.0.1:8332 and 127.0.0.1:18332

Reality: bitcoind bound to 10.18.0.1:8332 and 127.0.0.1:8332 and 127.0.0.1:18332 and ::1:18332. NOT 10.18.0.1:18332

Here is my bitcoin.conf

# Accept command line and JSON-RPC commands
server=1

# Set database cache size in megabytes (4 to 16384, default: 450)
dbcache=1536

# Set the number of script verification threads (-6 to 16, 0 = auto, <0 = leave that many cores free, default: 0)
par=1

# Set to blocksonly mode, sends and receives no lose transactions, instead handles only complete blocks
blocksonly=0
maxmempool=256

# Tries to keep outbound traffic under the given target (in MiB per 24h), 0 = no limit (default: 0)
maxuploadtarget=256

# Maintain at most <n> connections to peers (default: 125)
maxconnections=32

# Username for JSON-RPC connections
rpcuser=bitcoinrpc

# Password for JSON-RPC connections
rpcpassword=b956a61a2b6b8d30a744165384e3b61e

# Allow JSON-RPC connections from, by default only localhost are allowed
rpcbind=127.0.0.1
rpcbind=10.18.0.1
rpcallowip=127.0.0.1
rpcallowip=10.18.0.0/24

# Maintain a full transaction index, used by the getrawtransaction rpc call (default: 0)
txindex=1

# Make the wallet broadcast transactions (default: 1)
walletbroadcast=1

Am I doing something wrong?

michnovka

Posted 2019-06-29T15:46:20.510

Reputation: 137

Answers

1

This is mentioned in the Bitcoin Core 0.17 (which introduced network sections) release notes: https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-0.17.0.md#configuration-sections-for-testnet-and-regtest.

Certain options must be prefixed with a network, or they'll only apply to mainnet (addnode, connect, port, bind, rpcport, rpcbind, wallet), because they don't make sense to be shared across multiple networks.

Pieter Wuille

Posted 2019-06-29T15:46:20.510

Reputation: 54 032

0

I still have no idea as to WHY this is happening. But changing config to this:

[main]
# Allow JSON-RPC connections from, by default only localhost are allowed
rpcbind=127.0.0.1
rpcbind=10.18.0.1
rpcallowip=127.0.0.1
rpcallowip=10.18.0.0/24

[test]
# Use the test chain
testnet=1

rpcbind=127.0.0.1
rpcbind=10.18.0.1
rpcallowip=127.0.0.1
rpcallowip=10.18.0.0/24

Solved the issue

admin@az-bitcoind:~$ sudo netstat -natp | grep 8332
tcp        0      0 10.18.0.1:8332          0.0.0.0:*               LISTEN      566/bitcoind        
tcp        0      0 127.0.0.1:8332          0.0.0.0:*               LISTEN      566/bitcoind        
tcp        0      0 10.18.0.1:18332         0.0.0.0:*               LISTEN      567/bitcoind        
tcp        0      0 127.0.0.1:18332         0.0.0.0:*               LISTEN      567/bitcoind     

No idea why I have to duplicate this settings. I assumed that as long as [main] or [test] are not specified, all config options apply in general

michnovka

Posted 2019-06-29T15:46:20.510

Reputation: 137