| 1234 | } |
| 1235 | |
| 1236 | void |
| 1237 | State::cache_proposal(AuthenticatedContent content_auth) |
| 1238 | { |
| 1239 | auto ref = _suite.ref(content_auth); |
| 1240 | if (stdx::any_of(_pending_proposals, |
| 1241 | [&](const auto& cached) { return cached.ref == ref; })) { |
| 1242 | return; |
| 1243 | } |
| 1244 | |
| 1245 | auto sender_location = std::optional<LeafIndex>(); |
| 1246 | if (content_auth.content.sender.sender_type() == SenderType::member) { |
| 1247 | const auto& sender = content_auth.content.sender.sender; |
| 1248 | sender_location = var::get<MemberSender>(sender).sender; |
| 1249 | } |
| 1250 | |
| 1251 | const auto& proposal = var::get<Proposal>(content_auth.content.content); |
| 1252 | |
| 1253 | if (content_auth.content.sender.sender_type() == SenderType::external && |
| 1254 | !valid_external_proposal_type(proposal.proposal_type())) { |
| 1255 | throw ProtocolError("Invalid external proposal"); |
| 1256 | } |
| 1257 | |
| 1258 | if (!valid(sender_location, proposal)) { |
| 1259 | throw ProtocolError("Invalid proposal"); |
| 1260 | } |
| 1261 | |
| 1262 | _pending_proposals.push_back({ |
| 1263 | _suite.ref(content_auth), |
| 1264 | proposal, |
| 1265 | sender_location, |
| 1266 | }); |
| 1267 | } |
| 1268 | |
| 1269 | std::optional<State::CachedProposal> |
| 1270 | State::resolve(const ProposalOrRef& id, |
nothing calls this directly
no test coverage detected