Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 571 Lines • ▼ Show 20 Lines | if (redeemScript.size() > MAX_SCRIPT_ELEMENT_SIZE) { | ||||
strAddr); | strAddr); | ||||
return true; | return true; | ||||
} | } | ||||
return FillableSigningProvider::AddCScript(redeemScript); | return FillableSigningProvider::AddCScript(redeemScript); | ||||
} | } | ||||
static bool ExtractPubKey(const CScript &dest, CPubKey &pubKeyOut) { | static bool ExtractPubKey(const CScript &dest, CPubKey &pubKeyOut) { | ||||
// TODO: Use Solver to extract this? | std::vector<std::vector<uint8_t>> solutions; | ||||
CScript::const_iterator pc = dest.begin(); | return Solver(dest, solutions) == TX_PUBKEY && | ||||
opcodetype opcode; | (pubKeyOut = CPubKey(solutions[0])).IsFullyValid(); | ||||
std::vector<uint8_t> 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; | |||||
} | } | ||||
bool CWallet::AddWatchOnlyInMem(const CScript &dest) { | bool CWallet::AddWatchOnlyInMem(const CScript &dest) { | ||||
LOCK(cs_KeyStore); | LOCK(cs_KeyStore); | ||||
setWatchOnly.insert(dest); | setWatchOnly.insert(dest); | ||||
CPubKey pubKey; | CPubKey pubKey; | ||||
if (ExtractPubKey(dest, pubKey)) { | if (ExtractPubKey(dest, pubKey)) { | ||||
mapWatchKeys[pubKey.GetID()] = pubKey; | mapWatchKeys[pubKey.GetID()] = pubKey; | ||||
▲ Show 20 Lines • Show All 4,869 Lines • Show Last 20 Lines |