Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yaslama
Copy link

@yaslama yaslama commented Jun 10, 2019

No description provided.

@yaslama
Copy link
Author

yaslama commented Jun 14, 2019

@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.

Copy link
Collaborator

@guggero guggero left a 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.

// 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)
Copy link
Collaborator

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().

waddrmgr/address.go Outdated Show resolved Hide resolved
waddrmgr/scoped_manager.go Outdated Show resolved Hide resolved
waddrmgr/scoped_manager.go Outdated Show resolved Hide resolved
// 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
Copy link
Collaborator

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

waddrmgr/scoped_manager.go Outdated Show resolved Hide resolved
@guggero
Copy link
Collaborator

guggero commented Sep 30, 2021

Needs a rebase as well.

@yaslama
Copy link
Author

yaslama commented Oct 12, 2021

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants