[bitcoin/bitcoin] Add error handling to DecodeExtPubKey/DecodeExtKey and make sure return value is checked (via [[nodiscard]]) (#13971)

Add error handling to `DecodeExtPubKey`/`DecodeExtKey` and make sure return value is checked (via `[[nodiscard]]`).

Prior to this commit:

«`
$ cat > test.cpp

int main(void) {
CExtPubKey key = DecodeExtPubKey(«foo»);
std::cout << key.nChild << "\n"; } ^D $ g++ -o test test.cpp $ ./test 109452364 $ ./test -1789494196 $ ./test -1568076724 $ ./test 1483189324 $ ./test -1168606132 ``` You can view, comment on, or merge this pull request online at: https://github.com/bitcoin/bitcoin/pull/13971 -- Commit Summary -- * Add error checking to DecodeExtPubKey/DecodeExtKey * Add #define NODISCARD * Add NODISCARD to DecodeExtPubKey/DecodeExtKey -- File Changes -- M src/Makefile.am (1) A src/attributes.h (15) M src/key_io.cpp (16) M src/key_io.h (5) M src/script/descriptor.cpp (8) M src/test/bip32_tests.cpp (8) -- Patch Links -- https://github.com/bitcoin/bitcoin/pull/13971.patch https://github.com/bitcoin/bitcoin/pull/13971.diff

Добавить комментарий