Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions include/ccf/network_identity_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ namespace ccf
[[nodiscard]] virtual FetchStatus endorsements_fetching_status() const = 0;

/// Returns the COSE endorsements chain for the given sequence number,
/// or std::nullopt if endorsement fetching has not completed or the
/// chain is not available for the given sequence number.
/// or std::nullopt if the chain is not available for the given sequence
/// number.
///
/// @throws std::logic_error if endorsement fetching has not completed
/// (i.e. endorsements_fetching_status() != FetchStatus::Done).
[[nodiscard]] virtual std::optional<CoseEndorsementsChain>
get_cose_endorsements_chain(ccf::SeqNo seqno) const = 0;

Expand Down
7 changes: 4 additions & 3 deletions src/node/rpc/network_identity_subsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,12 @@ namespace ccf
[[nodiscard]] std::optional<CoseEndorsementsChain>
get_cose_endorsements_chain(ccf::SeqNo seqno) const override
{
// All other cases must be handled after recovery has been completed and
// identities have been successfully fetched.
if (fetch_status.load() != FetchStatus::Done)
{
return std::nullopt;
throw std::logic_error(fmt::format(
"COSE endorsements chain requested for seqno {} but endorsement "
"fetching has not been completed yet",
seqno));
}

if (!current_service_from.has_value())
Expand Down