MCPcopy Create free account
hub / github.com/LUX-Core/lux / ImportScript

Function ImportScript

src/rpcdump.cpp:183–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181
182void ImportAddress(const CTxDestination& dest, const std::string& strLabel);
183void ImportScript(const CScript& script, const std::string& strLabel, bool isRedeemScript)
184{
185 if (!isRedeemScript && ::IsMine(*pwalletMain, script) == ISMINE_SPENDABLE)
186 throw JSONRPCError(RPC_WALLET_ERROR, "The wallet already contains the private key for this address or script");
187
188 pwalletMain->MarkDirty();
189
190 if (!pwalletMain->HaveWatchOnly(script) && !pwalletMain->AddWatchOnly(script))
191 throw JSONRPCError(RPC_WALLET_ERROR, "Error adding address to wallet");
192
193 if (isRedeemScript) {
194 if (!pwalletMain->HaveCScript(script) && !pwalletMain->AddCScript(script))
195 throw JSONRPCError(RPC_WALLET_ERROR, "Error adding p2sh redeemScript to wallet");
196 ImportAddress(GetScriptForDestination(CScriptID(script)), strLabel);
197 } else {
198 CTxDestination destination;
199 if (ExtractDestination(script, destination)) {
200 pwalletMain->SetAddressBook(destination, strLabel, "receive");
201 }
202 }
203}
204
205void ImportAddress(const CTxDestination& dest, const std::string& strLabel)
206{

Callers 3

ImportAddressFunction · 0.85
importaddressFunction · 0.85
importpubkeyFunction · 0.85

Calls 12

IsMineFunction · 0.85
JSONRPCErrorFunction · 0.85
ImportAddressFunction · 0.85
GetScriptForDestinationFunction · 0.85
ExtractDestinationFunction · 0.85
HaveWatchOnlyMethod · 0.80
HaveCScriptMethod · 0.80
SetAddressBookMethod · 0.80
CScriptIDClass · 0.70
MarkDirtyMethod · 0.45
AddWatchOnlyMethod · 0.45
AddCScriptMethod · 0.45

Tested by

no test coverage detected