When the wallet is rescanned at startup in `bitcoind`, there seems to be no way to interrupt that in a clean way (other than forcefully killing the process).
{
    std::shared_ptr<CReserveKey> rKey = std::make_shared<CReserveKey>(this);
    CPubKey pubkey;
    if (!rKey->GetReservedKey(pubkey))
        return;
    script = rKey;
    script->reserveScript = CScript() << ToByteVector(pubkey) << OP_CHECKSIG;
}
void CWallet::LockCoin(const COutPoint& output)
{
    AssertLockHeld(cs_wallet); 
    setLockedCoins.insert(output);
}
void CWallet::UnlockCoin(const COutPoint& output)
{
    AssertLockHeld(cs_wallet); 
    setLockedCoins.erase(output);
}
void CWallet::UnlockAllCoins()