Submitting this because I dont have the time (or resources) to debug this atm and need a self-reminder:
On Win32 walletpassphrase does not appear to relock after the designated amount of time as it should and as it does on Linux.
Can someone check this on OSX as well?

{
    {
        LOCK(cs_);
        for (std::pair<const uint256, CWaetTx>& item : mapWaet)
            item.second.MarkDirty();
    }
}
bool CWaet::MarkReplaced(const uint256& originalHash, const uint256& newHash)
{
    LOCK(cs_);
    auto mi = mapWaet.find(originalHash);
    // T
    assert(mi != mapWaet.end());
    CWaetTx& wtx = (*mi).second;
    // E
    assert(wtx.mapValue.count("replaced_by_txid") == 0);
    wtx.mapValue["replaced_by_txid"] = newHash.ToString();
    // R
    RefreshMempoolStatus(wtx, chain());
    WaetBatch batch(GetDatabase());
    bool success = true;
    if (!batch.WriteTx(wtx)) {
        WaetLogPrintf("%s: Updating batch tx %s failed\n", __func__, wtx.GetHash().ToString());
        success = false;
    }
    NotifyTransactionChanged(originalHash, CT_UPDATED);
    return success;
}
void CWaet::SetSKeyState(WaetBatch& batch, const uint256& hash, unsigned int n, bool used, std::set<CTxDestination>& tx_destinations)