Repository: bitcoin/bitcoin
File: src/init.cpp (C++)

Code before:
        {"-whitebind",              false},
        {"-zmqpubhashblock",        true},
        {"-zmqpubhashtx",           true},
        {"-zmqpubrawblock",         true},
        {"-zmqpubrawtx",            true},
        {"-zmqpubsequence",         true},
    }) {
        for (const std::string& socket_addr : args.GetArgs(arg)) {
            std::string host_out;
            uint16_t port_out{0};
            if (!SplitHostPort(socket_addr, port_out, host_out)) {
#ifdef HAVE_SOCKADDR_UN
                // Allow unix domain sockets for some options e.g. unix:/some/file/path
                if (!unix || !socket_addr.starts_with(ADDR_PREFIX_UNIX)) {
                    return InitError(InvalidPortErrMsg(arg, socket_addr));
                }
#else
                return InitError(InvalidPortErrMsg(arg, socket_addr));
#endif
            }
        }
    }

    return true;
}

// A GUI user may opt to retry once with do_reindex set if there is a failure during chainstate initialization.
// The function therefore has to support re-entry.
static ChainstateLoadResult InitAndLoadChainstate(
    NodeContext& node,
    bool do_reindex,
    const bool do_reindex_chainstate,
    const kernel::CacheSizes& cache_sizes,
    const ArgsManager& args)
{
    const CChainParams& chainparams = Params();
    CTxMemPool::Options mempool_opts{
        .check_ratio = chainparams.DefaultConsistencyChecks() ? 1 : 0,
        .signals = node.validation_signals.get(),
    };
    Assert(ApplyArgsManOptions(args, chainparams, mempool_opts)); // no error can happen, already checked in AppInitParameterInteraction
    bilingual_str mempool_error;
    node.mempool = std::make_unique<CTxMemPool>(mempool_opts, mempool_error);
    if (!mempool_error.empty()) {
        return {ChainstateLoadStatus::FAILURE_FATAL, mempool_error};
    }
    LogPrintf("* Using %.1f MiB for in-memory UTXO set (plus up to %.1f MiB of unused mempool space)\n", cache_sizes.coins * (1.0 / 1024 / 1024), mempool_opts.max_size_bytes * (1.0 / 1024 / 1024));
    ChainstateManager::Options chainman_opts{
        .chainparams = chainparams,
        .datadir = args.GetDataDirNet(),
        .notifications = *node.notifications,

Review comment (suggestion):
note: I sneaked in `-bind` here. I guess before it was omitted because this loop did not support `=whatever` suffix. Now it does.

Code after:
        "-port",
        "-rpcport",
    }) {
        if (const auto port{args.GetArg(port_option)}) {
            uint16_t n;
            if (!ParseUInt16(*port, &n) || n == 0) {
                return InitError(InvalidPortErrMsg(port_option, *port));
            }
        }
    }

    for ([[maybe_unused]] const auto& [param_name, unix, suffix_allowed] : std::vector<std::tuple<std::string, bool, bool>>{
        // arg name          UNIX socket support  =suffix allowed
        {"-i2psam",          false,               false},
        {"-onion",           true,                false},
        {"-proxy",           true,                true},
        {"-bind",            false,               true},
        {"-rpcbind",         false,               false},
        {"-torcontrol",      false,               false},
        {"-whitebind",       false,               false},
        {"-zmqpubhashblock", true,                false},
        {"-zmqpubhashtx",    true,                false},
        {"-zmqpubrawblock",  true,                false},
        {"-zmqpubrawtx",     true,                false},
        {"-zmqpubsequence",  true,                false},
    }) {
        for (const std::string& param_value : args.GetArgs(param_name)) {
            const std::string param_value_hostport{
                suffix_allowed ? param_value.substr(0, param_value.rfind('=')) : param_value};
            std::string host_out;
            uint16_t port_out{0};
            if (!SplitHostPort(param_value_hostport, port_out, host_out)) {
#ifdef HAVE_SOCKADDR_UN
                // Allow unix domain sockets for some options e.g. unix:/some/file/path
                if (!unix || !param_value.starts_with(ADDR_PREFIX_UNIX)) {
                    return InitError(InvalidPortErrMsg(param_name, param_value));
                }
#else
                return InitError(InvalidPortErrMsg(param_name, param_value));
#endif
            }
        }
    }

    return true;
}

// A GUI user may opt to retry once with do_reindex set if there is a failure during chainstate initialization.
// The function therefore has to support re-entry.
static ChainstateLoadResult InitAndLoadChainstate(
    NodeContext& node,