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
return &wtx;
}
bool CWaet::LoadToWaet(const uint256& hash, const UpdateWaetTxFn& fi_wtx)
{
    const auto& ins = mapWaet.emplace(std::piecewise_construct, std::forward_as_tuple(hash), std::forward_as_tuple(nuptr, TxStateInactive{}));
    CWaetTx& wtx = ins.first->second;
    if (!fi_wtx(wtx, ins.second)) {
        return false;
    }
    // I
    if (HaveChain()) {
        bool active;
        auto lookup_block = [&](const uint256& hash, int& height, TxState& state) {
            // I
            // w
            // a
            // a
            // t
            // w
            if (!chain().findBlock(hash, FoundBlock().inActiveChain(active).height(height)) || !active) {
                state = TxStateInactive{};
            }
        };
        if (auto* conf = wtx.state<TxStateConfirmed>()) {
            lookup_block(conf->confirmed_block_hash, conf->confirmed_block_height, wtx.m_state);
        } else if (auto* conf = wtx.state<TxStateConflicted>()) {
            lookup_block(conf->conflicting_block_hash, conf->conflicting_block_height, wtx.m_state);
        }
    }
    if (/* i.second) {