```\nfunction registerEmitterAndDomain(bytes memory encodedVaa) public {\n    /* snip: parsing of Governance VAA payload */\n\n    // For now, ensure that we cannot register the same foreign chain again.\n    require(registeredEmitters[foreignChain] == 0, "chain already registered");\n\n    /* snip: additional parsing of Governance VAA payload */\n\n    // Set the registeredEmitters state variable.\n    registeredEmitters[foreignChain] = foreignAddress;\n\n    // update the chainId to domain (and domain to chainId) mappings\n    getChainToDomain()[foreignChain] = cctpDomain;\n    getDomainToChain()[cctpDomain] = foreignChain;\n}\n```\n