New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for pay to witness script address #625
base: master
Are you sure you want to change the base?
Conversation
@Roasbeef @wpaulino @halseth @cfromknecht What do you think about this PR? It's not intrusive at all, quite trivial, and only add standard witness address type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR and sorry for the delay in the review!
Looks pretty good, main comments are around code duplication and what key to use to encrypt the script. Some test cases to get basic coverage would be nice as well.
waddrmgr/address.go
Outdated
// Decrypt the script as needed. Also, make sure it's a copy since the | ||
// script stored in memory can be cleared at any time. Otherwise, | ||
// the returned script could be invalidated from under the caller. | ||
return a.unlock(a.manager.rootManager.cryptoKeyScript) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know the non-segwit scriptAddress
above uses this crypto key. But I'm thinking that we might want to support watch-only witness script addresses. So I'm not sure if we should use the cryptokeyPub
here instead? Then we don't need the check for a.manager.rootManager.WatchOnly()
or a.manager.rootManager.IsLocked()
.
// All imported script addresses will be part of the account defined by the | ||
// ImportedAddrAccount constant. | ||
// | ||
// When the address manager is watching-only, the script itself will not be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment above about this sentence. Or maybe we can add a switch to decide whether this is considered to be that private? So the user of the library can choose what crypto key to use? cc @Roasbeef
Needs a rebase as well. |
414da38
to
dafb7c4
Compare
@guggero I created a new type baseScriptAddress as you suggested. Concerning the watch-only stuff, it's not specific to witness script addresses, so it's quite orthogonal to this specific PR. |
No description provided.