Skip to content

Conversation

achow101
Copy link
Member

The places where we need to lookup information for a XOnlyPubKey
currently implement a hack which makes both serializations of the full
pubkey in order to try the CKeyIDs for the lookup functions. Instead of
duplicating this everywhere it is needed, we can consolidate the CKeyID
generation into a function, and then have wrappers around GetPubKey,
GetKey, and GetKeyOrigin which takes the XOnlyPubKey, retrieves all of
the CKeyIDs (using the new GetKeyIDs() function in XOnlyPubKey), and
tries their respective underlying lookup function.

Split from #22364

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 21, 2021

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

No conflicts as of last run.

@tryphe
Copy link
Contributor

tryphe commented Jul 30, 2021

Concept ACK

nit: Maybe put the convenience function code blocks in signingprovider.cpp? But it doesn't exist yet because the existing functions are virtual. Gah.

@theStack
Copy link
Contributor

Concept ACK

Copy link
Contributor

@S3RK S3RK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review ACK. Need rebase though

@@ -180,6 +180,23 @@ XOnlyPubKey::XOnlyPubKey(Span<const unsigned char> bytes)
std::copy(bytes.begin(), bytes.end(), m_keydata.begin());
}

std::vector<CKeyID> XOnlyPubKey::GetKeyIDs() const
{
std::vector<CKeyID> out;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe use a fixed size array here? 🤷‍♂️

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to leave open the possibility for future keyids, so std::vector seemed better for that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you are hinting at. Can you give me an hypothetical example?

@Zero-1729
Copy link
Contributor

Concept ACK

@achow101
Copy link
Member Author

Rebased

Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-review ACK 4881102 🔑

Copy link
Contributor

@Zero-1729 Zero-1729 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crACK 4881102

Copy link
Contributor

@S3RK S3RK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK 4881102

The places where we need to lookup information for a XOnlyPubKey
currently implement a hack which makes both serializations of the full
pubkey in order to try the CKeyIDs for the lookup functions. Instead of
duplicating this everywhere it is needed, we can consolidate the CKeyID
generation into a function, and then have wrappers around GetPubKey,
GetKey, and GetKeyOrigin which takes the XOnlyPubKey, retrieves all of
the CKeyIDs (using the new GetKeyIDs() function in XOnlyPubKey), and
tries their respective underlying lookup function.
@S3RK
Copy link
Contributor

S3RK commented Aug 24, 2021

Code Review reACK d9d3ec0

Copy link
Contributor

@Zero-1729 Zero-1729 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-crACK d9d3ec0

Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-ACK d9d3ec0

Copy link
Contributor

@meshcollider meshcollider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review + functional test run ACK d9d3ec0

@meshcollider meshcollider merged commit 9a86327 into bitcoin:master Sep 2, 2021
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Sep 2, 2021
d9d3ec0 Consolidate XOnlyPubKey lookup hack (Andrew Chow)

Pull request description:

  The places where we need to lookup information for a XOnlyPubKey
  currently implement a hack which makes both serializations of the full
  pubkey in order to try the CKeyIDs for the lookup functions. Instead of
  duplicating this everywhere it is needed, we can consolidate the CKeyID
  generation into a function, and then have wrappers around GetPubKey,
  GetKey, and GetKeyOrigin which takes the XOnlyPubKey, retrieves all of
  the CKeyIDs (using the new GetKeyIDs() function in XOnlyPubKey), and
  tries their respective underlying lookup function.

  Split from bitcoin#22364

ACKs for top commit:
  S3RK:
    Code Review reACK d9d3ec0
  Zero-1729:
    re-crACK d9d3ec0
  theStack:
    re-ACK d9d3ec0
  meshcollider:
    Code review + functional test run ACK d9d3ec0

Tree-SHA512: 21a7f6d37fad74483a38006f82b3558337fe9ed30e0b4392e6fff82c22251a42ac996b43f06cdaa9289ee34a768e181d87aa4208b5538e36ae4977954e1fa6a0
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants