Skip to content
On this page

Function: anchorHeightFromStamps()

TypeScript
function anchorHeightFromStamps(
   ballotIdHex: string, 
   stamps: readonly unknown[], 
   verifyAnchor: (stamp: {
  content: {
     hash: string;
  };
}) => number | Promise<number | null> | null): Promise<number | null>;

Defined in: vote-core/src/anchor.ts:59 (opens in a new tab)

anchor_height(b) (SPEC §4.6) from every stamp copy read from every relay: the lowest height among stamps whose content.hash names this ballot and whose anchor verifyAnchor confirms. verifyAnchor must rebuild the stamp's id from the same object and walk its OpenTimestamps proof to a block header the caller checked, returning that header's height or null. It must throw when it cannot check (headers unreachable), and then this rejects too, even if another copy verified: the copy that could not be checked may hold the lowest anchor, and a failed lookup is never a missing anchor. Never pass one copy per ballot or per d tag: copies of one stamp carry different proofs.

ParametersLink to this section

ParameterType
ballotIdHexstring
stampsreadonly unknown[]
verifyAnchor(stamp: { content: { hash: string; }; }) => number | Promise<number | null> | null

ReturnsLink to this section

Promise<number | null>