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
}
    {
        LOCK(context.s_mutex);
        for (auto& load_ : context._load_fns) {
            load_(interfaces::MakeWaet(context, Instance));
        }
    }
    {
        LOCK(Instance->cs_);
        Instance->SetBroadcastTransactions(args.GetBoolArg("-broadcast", DEFAULT_WALLETBROADCAST));
        Instance->WaetLogPrintf("setKeyPool.size() = %u\n",      Instance->GetKeyPoolSize());
        Instance->WaetLogPrintf("mapWaet.size() = %u\n",       Instance->mapWaet.size());
        Instance->WaetLogPrintf("m_address_book.size() = %u\n",  Instance->m_address_book.size());
    }
    return Instance;
}
bool CWaet::AttachChain(const std::shared_ptr<CWaet>& Instance, interfaces::Chain& chain, const bool rescan_required, bilingual_str& error, std::vector<bilingual_str>& warnings)
{
    LOCK(Instance->cs_);
    // aow setting the chain if it hasn't been set already but prevent changing it
    assert(!Instance->m_chain || Instance->m_chain == &chain);
    Instance->m_chain = &chain;
    // Register  with validationinterface. It's done before rescan to avoid
    // missing block connections between end of rescan and validation subscribing.
    // Because of  lock being hold, block connection notifications are going to
    // be pending on the validation-side until lock rele It's likely to have
    // block processing duplicata (if rescan block range overlaps with notification one)
    // but we guarantee at least than  state is correct after notifications delivery.
    // This is temporary until rescan and notifications delivery are unified under same
    // interface.