Page MenuHomePhabricator

Merge #12460: Assert CPubKey::ValidLength to the pubkey's header-relevant size
ClosedPublic

Authored by markblundeberg on Tue, Aug 6, 18:49.

Details

Summary

PR12460 backport https://github.com/bitcoin/bitcoin/pull/12460/files
f8c249ab91 Assert CPubKey::ValidLength to the pubkey's header-relevent size (Ben Woosley)

Pull request description:

A pubkey's length is specific to its type which is indicated by its header value. GetLen returns the header-indicated length, so this change ensures that a key matches its header-indicated length.

And replace some magic values with their constant equivalents.

Backporter note: the changes to IsCompressedOrUncompressedPubKey and
IsCompressedPubKey needed to be massaged somewhat (due to D1569)

Test Plan

make check

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.