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).
if (!encrypted_batch->TxnBegin()) {
            delete encrypted_batch;
            encrypted_batch = nullptr;
            return false;
        }
        encrypted_batch->WriteMasterKey(nMasterKeyMaxID, kMasterKey);
        if (!EncryptKeys(_vMasterKey))
        {
            encrypted_batch->TxnAbort();
            delete encrypted_batch;
            
            
            assert(false);
        }
        
        SetMinVersion(FEATURE_WALLETCRYPT, encrypted_batch, true);
        if (!encrypted_batch->TxnCommit()) {
            delete encrypted_batch;
            
            
            assert(false);
        }
        delete encrypted_batch;
        encrypted_batch = nullptr;
        Lock();
        Unlock(strWalletPassphrase);
        
        if (IsHDEnabled()) {
            if (!SetHDMasterKey(GenerateNewHDMasterKey())) {
                return false;