urma_node_client/projection.rs
1//! Shared application views over the owning archive. These are local index
2//! results, not portable cryptographic proofs or claims of interval completeness.
3use crate::model::ArchiveStatus;
4use bitcoin::{BlockHash, Wtxid};
5use serde::{Deserialize, Serialize};
6
7pub const MAX_WIRE_PAGE: u32 = 128;
8
9/// Opaque consistency token for this engine instance and archive revision.
10/// Restart, reorg, or any committed archive event invalidates old cursors.
11/// A consumer must discard a partial traversal on a stale-cursor error.
12#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
13#[serde(deny_unknown_fields)]
14pub struct IndexSnapshot {
15 pub instance: String,
16 pub revision: u64,
17}
18
19/// Continuation within one snapshot, ordered by selected height and position.
20/// The token is not an authorization capability or evidence of completeness.
21#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
22#[serde(deny_unknown_fields)]
23pub struct WireCursor {
24 pub snapshot: IndexSnapshot,
25 pub height: u64,
26 pub position: u32,
27}
28
29#[derive(Clone, Serialize, Deserialize)]
30#[serde(deny_unknown_fields)]
31pub struct WireRecord {
32 pub block_hash: BlockHash,
33 pub wtxid: Wtxid,
34 pub entry: urma_wire::index::Entry,
35}
36
37/// Selected, locally admitted Wire records, including selective admissions.
38/// `next == None` means the local result set ended, not that a peer or the chain
39/// contains no other records. Coverage is reported separately in `archive`.
40/// Bytes/author/TXID originate from prior archive admission; this response does
41/// not carry inclusion proofs. Untrusted recipients must obtain and verify the
42/// corresponding RecordPackage against their own chain view instead.
43#[derive(Clone, Serialize, Deserialize)]
44#[serde(deny_unknown_fields)]
45pub struct WirePage {
46 pub snapshot: IndexSnapshot,
47 pub archive: ArchiveStatus,
48 pub records: Vec<WireRecord>,
49 pub next: Option<WireCursor>,
50}