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

wallet: extract PubKey from P2PK script with Solver #16753

merged 1 commit into from Aug 30, 2019
Changes from all commits
File filter
Filter by extension
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -523,18 +523,9 @@ bool CWallet::LoadCScript(const CScript& redeemScript)

static bool ExtractPubKey(const CScript &dest, CPubKey& pubKeyOut)
//TODO: Use Solver to extract this?
CScript::const_iterator pc = dest.begin();
opcodetype opcode;
std::vector<unsigned char> vch;
if (!dest.GetOp(pc, opcode, vch) || !CPubKey::ValidSize(vch))
return false;
pubKeyOut = CPubKey(vch);
if (!pubKeyOut.IsFullyValid())
return false;
if (!dest.GetOp(pc, opcode, vch) || opcode != OP_CHECKSIG || dest.GetOp(pc, opcode, vch))
return false;
return true;
std::vector<std::vector<unsigned char>> solutions;
return Solver(dest, solutions) == TX_PUBKEY &&
(pubKeyOut = CPubKey(solutions[0])).IsFullyValid();

bool CWallet::AddWatchOnlyInMem(const CScript &dest)