Skip to content

Warning is not an error #7130

@arnuschky

Description

@arnuschky

Currently, bitcoind reports an error when it wants to warn the user (eg, when hitting an outdated version):

bitcoin-cli getinfo
{
    "version" : 110100,
    "protocolversion" : 70002,
    "walletversion" : 60000,
    "balance" : 1.69743172,
    "blocks" : 385894,
    "timeoffset" : 0,
    "connections" : 8,
    "proxy" : "",
    "difficulty" : 72722780642.54718018,
    "testnet" : false,
    "keypoololdest" : 1423141169,
    "keypoolsize" : 10001,
    "unlocked_until" : 0,
    "paytxfee" : 0.00000000,
    "relayfee" : 0.00005000,
    "errors" : "Warning: This version is obsolete; upgrade required!"
}

Now, this is confusing. A warning is not an error. Warnings should be reported, but should not stop processing as errors do.

The problem with the current behavior is that it causes libraries to bail: common behavior is to check for the presence of errors in the result to report an error to the calling code. An example is python-bitcoinrpc: the library raises an exception, which interrupts the normal processing of the result. This happily breaks production systems due to a non-criticial warning.

Cleanest way would be to add a warnings field in the results. However, this would require all libs to be updated so that the warning is not silently swallowed but exposed to the user.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions