Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcdump.cpp
Show First 20 Lines • Show All 338 Lines • ▼ Show 20 Lines | if (!request.params[3].isNull()) { | ||||
strLabel, {GetScriptForDestination(dest)}, | strLabel, {GetScriptForDestination(dest)}, | ||||
false /* have_solving_data */, true /* apply_label */, | false /* have_solving_data */, true /* apply_label */, | ||||
1 /* timestamp */); | 1 /* timestamp */); | ||||
} else if (IsHex(request.params[0].get_str())) { | } else if (IsHex(request.params[0].get_str())) { | ||||
std::vector<uint8_t> data(ParseHex(request.params[0].get_str())); | std::vector<uint8_t> data(ParseHex(request.params[0].get_str())); | ||||
CScript redeem_script(data.begin(), data.end()); | CScript redeem_script(data.begin(), data.end()); | ||||
std::set<CScript> scripts = {redeem_script}; | std::set<CScript> scripts = {redeem_script}; | ||||
pwallet->ImportScripts(scripts); | pwallet->ImportScripts(scripts, 0 /* timestamp */); | ||||
if (fP2SH) { | if (fP2SH) { | ||||
scripts.insert(GetScriptForDestination( | scripts.insert(GetScriptForDestination( | ||||
ScriptHash(CScriptID(redeem_script)))); | ScriptHash(CScriptID(redeem_script)))); | ||||
} | } | ||||
pwallet->ImportScriptPubKeys( | pwallet->ImportScriptPubKeys( | ||||
strLabel, scripts, false /* have_solving_data */, | strLabel, scripts, false /* have_solving_data */, | ||||
▲ Show 20 Lines • Show All 1,126 Lines • ▼ Show 20 Lines | try { | ||||
"key for this address or script (\"" + | "key for this address or script (\"" + | ||||
HexStr(script.begin(), script.end()) + | HexStr(script.begin(), script.end()) + | ||||
"\")"); | "\")"); | ||||
} | } | ||||
} | } | ||||
// All good, time to import | // All good, time to import | ||||
pwallet->MarkDirty(); | pwallet->MarkDirty(); | ||||
if (!pwallet->ImportScripts(import_data.import_scripts)) { | if (!pwallet->ImportScripts(import_data.import_scripts, timestamp)) { | ||||
throw JSONRPCError(RPC_WALLET_ERROR, | throw JSONRPCError(RPC_WALLET_ERROR, | ||||
"Error adding script to wallet"); | "Error adding script to wallet"); | ||||
} | } | ||||
if (!pwallet->ImportPrivKeys(privkey_map, timestamp)) { | if (!pwallet->ImportPrivKeys(privkey_map, timestamp)) { | ||||
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding key to wallet"); | throw JSONRPCError(RPC_WALLET_ERROR, "Error adding key to wallet"); | ||||
} | } | ||||
if (!pwallet->ImportPubKeys(ordered_pubkeys, pubkey_map, | if (!pwallet->ImportPubKeys(ordered_pubkeys, pubkey_map, | ||||
import_data.key_origins, add_keypool, | import_data.key_origins, add_keypool, | ||||
▲ Show 20 Lines • Show All 352 Lines • Show Last 20 Lines |