HomePhabricator

rpc: fix -rpcclienttimeout 0 option

Description

rpc: fix -rpcclienttimeout 0 option

Summary:
When -rpcclienttimeout=0 was provided, the default libevent timeout of 50 s was used, instead of no timeout as documented.
This change fixes it by setting timeout to 5 years when 0 is passed to -rpcclienttimeout.

This is a backport of Core PR17131

Test Plan:

$ src/bitcoin-cli -rpcclienttimeout=10 gettxoutsetinfo
error: Could not connect to the server 127.0.0.1:8332 (error code 0 - "timeout reached")
$ time src/bitcoin-cli -rpcclienttimeout=0 gettxoutsetinfo
{
  "height": 658626,
  "bestblock": "000000000000000002050eb8ee46cdb7d56cbc816ca13e3de000bee82bde9d34",
  "transactions": 17556030,
  "txouts": 37933218,
  "bogosize": 2871043050,
  "hash_serialized": "4790608c2e6ef02606f38680d5716b632e6cb006284c7f36c269d73be038496c",
  "disk_size": 2156465916,
  "total_amount": 18553754.67451907
}

real	1m52,365s
user	0m0,006s
sys	0m0,001s

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

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

Details

Provenance
Fabian Jahr <fjahr@protonmail.com>Authored on Oct 25 2020, 19:37
PiRKCommitted on Oct 25 2020, 19:37
abc-botPushed on Oct 25 2020, 19:42
Reviewer
Restricted Owners Package
Differential Revision
D8109: rpc: fix -rpcclienttimeout 0 option
Parents
rABC4289dc7952fc: add stdin helpers for password input support
Branches
Unknown
Tags
Unknown