|
|
@ -143,7 +143,7 @@ UniValue importprivkey(const JSONRPCRequest& request) |
|
|
|
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding key to wallet"); |
|
|
|
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding key to wallet"); |
|
|
|
|
|
|
|
|
|
|
|
// whenever a key is imported, we need to scan the whole chain
|
|
|
|
// whenever a key is imported, we need to scan the whole chain
|
|
|
|
pwalletMain->nTimeFirstKey = 1; // 0 would be considered 'no value'
|
|
|
|
pwalletMain->UpdateTimeFirstKey(1); |
|
|
|
|
|
|
|
|
|
|
|
if (fRescan) { |
|
|
|
if (fRescan) { |
|
|
|
pwalletMain->ScanForWalletTransactions(chainActive.Genesis(), true); |
|
|
|
pwalletMain->ScanForWalletTransactions(chainActive.Genesis(), true); |
|
|
@ -500,8 +500,7 @@ UniValue importwallet(const JSONRPCRequest& request) |
|
|
|
while (pindex && pindex->pprev && pindex->GetBlockTime() > nTimeBegin - 7200) |
|
|
|
while (pindex && pindex->pprev && pindex->GetBlockTime() > nTimeBegin - 7200) |
|
|
|
pindex = pindex->pprev; |
|
|
|
pindex = pindex->pprev; |
|
|
|
|
|
|
|
|
|
|
|
if (!pwalletMain->nTimeFirstKey || nTimeBegin < pwalletMain->nTimeFirstKey) |
|
|
|
pwalletMain->UpdateTimeFirstKey(nTimeBegin); |
|
|
|
pwalletMain->nTimeFirstKey = nTimeBegin; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LogPrintf("Rescanning last %i blocks\n", chainActive.Height() - pindex->nHeight + 1); |
|
|
|
LogPrintf("Rescanning last %i blocks\n", chainActive.Height() - pindex->nHeight + 1); |
|
|
|
pwalletMain->ScanForWalletTransactions(pindex); |
|
|
|
pwalletMain->ScanForWalletTransactions(pindex); |
|
|
@ -782,9 +781,7 @@ UniValue ProcessImport(const UniValue& data, const int64_t timestamp) |
|
|
|
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding key to wallet"); |
|
|
|
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding key to wallet"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (timestamp < pwalletMain->nTimeFirstKey) { |
|
|
|
pwalletMain->UpdateTimeFirstKey(timestamp); |
|
|
|
pwalletMain->nTimeFirstKey = timestamp; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -912,9 +909,7 @@ UniValue ProcessImport(const UniValue& data, const int64_t timestamp) |
|
|
|
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding key to wallet"); |
|
|
|
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding key to wallet"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (timestamp < pwalletMain->nTimeFirstKey) { |
|
|
|
pwalletMain->UpdateTimeFirstKey(timestamp); |
|
|
|
pwalletMain->nTimeFirstKey = timestamp; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
success = true; |
|
|
|
success = true; |
|
|
|
} |
|
|
|
} |
|
|
|