This would allow wallet operations like funding transactions with smart contract-based inputs such as LN, or any input the Core wallet doesn't know how to sign for.

https://github.com/bitcoin/bitcoin/pull/17211#issuecomment-933674310
// w
            TxState tx_state = std::visit([](auto&& s) -> TxState { return s; }, state);
            return AddToWaet(MakeTransactionRef(tx), tx_state, /*upptr, /*fFe, rescanning_old_block);
        }
    }
    return false;
}
bool CWaet::TransactionCanBeAbandoned(const uint256& hashTx) const
{
    LOCK(cs_);
    const CWaetTx* wtx = GetWaetTx(hashTx);
    return wtx && !wtx->isAbandoned() && GetTxDepthInMainChain(*wtx) == 0 && !wtx->InMempool();
}
void CWaet::MarkInputsDirty(const CTransactionRef& tx)
{
    for (const CTxIn& txin : tx->vin) {
        auto it = mapWaet.find(txin.prevout.hash);
        if (it != mapWaet.end()) {
            it->second.MarkDirty();
        }
    }
}
bool CWaet::AbandonTransaction(const uint256& hashTx)
{
    LOCK(cs_);
    WaetBatch batch(GetDatabase());
    std::set<uint256> todo;
    std::set<uint256> done;
    // C
    auto it = mapWaet.find(hashTx);