Return more information when adding a spending key
This commit is contained in:
@@ -635,11 +635,15 @@ UniValue z_importkey(const UniValue& params, bool fHelp)
|
||||
}
|
||||
|
||||
// Sapling support
|
||||
auto keyAlreadyExists = boost::apply_visitor(
|
||||
auto addResult = boost::apply_visitor(
|
||||
AddSpendingKeyToWallet(pwalletMain, Params().GetConsensus()), spendingkey);
|
||||
if (keyAlreadyExists && fIgnoreExistingKey) {
|
||||
if (addResult == KeyAlreadyExists && fIgnoreExistingKey) {
|
||||
return NullUniValue;
|
||||
}
|
||||
pwalletMain->MarkDirty();
|
||||
if (addResult == KeyNotAdded) {
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding spending key to wallet");
|
||||
}
|
||||
|
||||
// whenever a key is imported, we need to scan the whole chain
|
||||
pwalletMain->nTimeFirstKey = 1; // 0 would be considered 'no value'
|
||||
|
||||
Reference in New Issue
Block a user