Skip to content

Conversation

@practicalswift
Copy link
Contributor

@practicalswift practicalswift commented Aug 1, 2017

Check return value of addr.GetKeyID(keyid) on custom change address change. Prior to this commit this was the only place where the return value of GetKeyID(…) was unchecked.

Clarify our assumption of addr.GetKeyID(keyid) being true in this context via an assertion.

(Note to reviewers: Let me know if this assumption is not being made. If the assumption is not made then the case of !addr.GetKeyID(keyid) should obviously be handled more gracefully than with an assert :-))

@practicalswift practicalswift changed the title Check return value of addr.GetKeyID(keyid) on custom change address change [Qt] Check return value of addr.GetKeyID(keyid) on custom change address change Aug 1, 2017
@promag
Copy link
Contributor

promag commented Aug 1, 2017

utACK 65bb605.

@jonasschnelli
Copy link
Contributor

utACK 65bb605b71f0494d23d61f545f7638df60b23e10

@gmaxwell
Copy link
Contributor

gmaxwell commented Aug 4, 2017

This looks like it will be an instant crash if you put a P2SH address in the field.

@practicalswift
Copy link
Contributor Author

practicalswift commented Aug 4, 2017

@gmaxwell Thanks for reviewing and clarifying that the old code does not assume addr.GetKeyID(keyid) being true.

I've now changed to if (!valid || !model->havePrivKey(keyid)) { … } for the unknown change address code path - looks good? :-)

@gmaxwell
Copy link
Contributor

gmaxwell commented Aug 4, 2017

I think the code there just doesn't correctly handle p2sh keys in general. Probably needs a more extensive fixup than that, though the assert seems clearly not right. :)

@TheBlueMatt
Copy link
Contributor

Likely not neccessary if #11184 lands.

@practicalswift
Copy link
Contributor Author

@TheBlueMatt Thanks for the notification! @dooglus PR is the better choice. Closing this PR! :-)

@practicalswift practicalswift deleted the GetKeyID-assertion branch April 10, 2021 19:32
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants