This change improves the usability of the dumptxoutset RPC in two ways, in the case that an invalid path is passed:
- return from the RPC immediately, rather then when the file is first tried to be written (which is after calculating the UTXO set hash)
- return a proper return code and error message instead of the cryptic message that appears on master currently (see below)
master branch: (error message appears after several minutes on my machine)
$ ./src/bitcoin-cli dumptxoutset /invalid/path
error code: -1
error message:
CAutoFile::operator<<: file handle is nullptr: unspecified iostream_category error
PR branch: (error message appears immediately)
$ ./src/bitcoin-cli dumptxoutset /invalid/path
error code: -8
error message:
Couldn't open file /invalid/path.incomplete for writing.