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

try to sweep p2pk outputs from old type WIF privkeys #3125

Merged
merged 1 commit into from
Oct 27, 2017

Conversation

SomberNight
Copy link
Member

See #2857

Now that the most widely used server implementation, ElectrumX, with version 1.2, properly separates P2PK and P2PKH scripts, we can implement a way for users to spend P2PK outputs.

In this PR, I propose enabling the sweep functionality to redeem these coins. Unfortunately, the WIF format for private keys gives no hint if P2PK scripts are to be used. What I do, is search for both P2PK and P2PKH scripts whenever an "old type" (pre-segwit) WIF is swept from. The compressed byte is assumed to be correct, the same boolean is used for both script types.

I think the fact that (in some sense) duplicate queries are sent to servers (hence e.g. increasing load/bandwidth), can be overlooked, given sweeping is a rare operation. IMHO it is more important for users to be able to access these coins than to avoid looking up both script types at all costs. So while it might not be desirable to always subscribe to both script types (say) in an imported wallet, this one-time cost can be afforded.

I've tested this on regtest with ElectrumX 1.2.

@ecdsa ecdsa merged commit 6f3c822 into spesmilo:master Oct 27, 2017
@ecdsa
Copy link
Member

ecdsa commented Oct 27, 2017

note: that will not work on all servers

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