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);
    auto it = context._load_fns.emplace(context._load_fns.end(), std::move(load_));
    return interfaces::MakeHandler([&context, it] { LOCK(context.s_mutex); context._load_fns.erase(it); });
}
static Mutex g_loading__mutex;
static Mutex g__release_mutex;
static std::condition_variable g__release_cv;
static std::set<std::string> g_loading__set GUARDED_BY(g_loading__mutex);
static std::set<std::string> g_unloading__set GUARDED_BY(g__release_mutex);
static void ReleaseWaet(CWaet* )
{
    const std::string name = ->GetName();
    ->WaetLogPrintf("Releasing \n");
    ->Flush();
    delete ;
    
    {
        LOCK(g__release_mutex);
        if (g_unloading__set.erase(name) == 0) {
            
            return;
        }
    }
    g__release_cv.notify_a();
}
void UnloadWaet(std::shared_ptr<CWaet>&& )