Page MenuHomePhabricator

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

Authored by markblundeberg on Aug 6 2019, 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.

Event Timeline

markblundeberg created this revision.Aug 6 2019, 18:49
Herald added a reviewer: Restricted Project. · View Herald TranscriptAug 6 2019, 18:49
jasonbcox accepted this revision.Aug 6 2019, 19:08
This revision is now accepted and ready to land.Aug 6 2019, 19:08
nakihito accepted this revision.Aug 6 2019, 22:21