pub struct WalletCoinsByParentParams {
pub parent_coin_id: String,
pub after_coin_id: Option<String>,
pub limit: Option<u32>,
}Expand description
control.wallet.coinsByParent params: WHICH coin’s direct children to read.
§One hop, and the field name says so
The field is parent_coin_id rather than coin_id because the coin named here is the one being
asked ABOUT as a parent — it is never the coin the caller wants back. A walk up or down a lineage
is the CALLER’s composition of repeated single hops; the node performs exactly one. Naming it
coin_id would make a recursive reading of the method plausible from the request alone, and a
caller expecting a whole lineage from one call would read a one-hop answer as a truncated chain.
§Bounded, because a parent’s child count is not
This is the only OPEN wallet read whose answer has unbounded cardinality — every other one
returns a single record (coinById, peak, syncStatus) or is already paged (arrivals). So
the read is PAGED, and the page is bounded by COINS_BY_PARENT_MAX_LIMIT.
The bound is the ONLY thing bounding this call — there is no rate limiter anywhere behind it. dig-node’s control plane has no request rate limiting of any kind (dig_ecosystem#2577); the bandwidth limiter it does have governs content serving and is not on this path. A future reader weighing whether to relax this cap should assume no limiter exists, because none does.
That matters more than a local resource bound would, because the node does not necessarily answer from its own replica: on the fallback tier it forwards a caller-supplied identifier to a THIRD-PARTY coinset HTTPS oracle. An unbounded page is therefore unbounded work against somebody else’s service, requested by a token-less caller on a loopback endpoint.
Paging rather than a bare cap, because a bare cap is a dead end: a parent with more children than the cap could never be fully enumerated, and this method exists to WALK a lineage. A walk that cannot see past the cap is a walk that silently stops.
Fields§
§parent_coin_id: StringThe PARENT coin’s id: lowercase 64-hex, unprefixed. A 0x prefix is TOLERATED on input and
normalized away by Self::validated; it is never emitted.
after_coin_id: Option<String>Resume STRICTLY AFTER this child, in the read’s
documented order. None starts at the first child.
This is the value the previous page handed back as
cursor — never a value the caller invented,
and never a marker for where the chain “got to”. control.wallet.arrivals records why that
distinction loses rows; this read avoids the trap by having no such marker to reach for.
limit: Option<u32>The page size. None asks for COINS_BY_PARENT_DEFAULT_LIMIT.
A value above COINS_BY_PARENT_MAX_LIMIT, or a zero, is REFUSED as INVALID_PARAMS rather
than clamped — see Self::validated.
Implementations§
Source§impl WalletCoinsByParentParams
impl WalletCoinsByParentParams
Sourcepub fn first_page(parent_coin_id: impl Into<String>) -> Self
pub fn first_page(parent_coin_id: impl Into<String>) -> Self
A first page of children for one parent: the node’s default size, starting at the beginning.
The common case, and the one a caller should not have to spell out — naming a page size means asserting a number this caller invented over the one the contract chose.
Sourcepub fn effective_limit(&self) -> u32
pub fn effective_limit(&self) -> u32
The page size this request asks for, resolving None to COINS_BY_PARENT_DEFAULT_LIMIT.
Stated once here so a node and a client cannot resolve the same omitted field to two different numbers — a disagreement that would show up as a page boundary in the wrong place, which is exactly where a paged walk loses rows.
Sourcepub fn validated(self) -> Result<Self, ControlError>
pub fn validated(self) -> Result<Self, ControlError>
Normalize and check both ids and the page bound, or reject as -32602 INVALID_PARAMS.
The ids follow the rule every by-coin read in this crate follows (lowercase 64-hex, 0x
tolerated on input and never emitted).
An out-of-range limit is REFUSED, never clamped. That is a deliberate departure from
control.wallet.arrivals, which lets a node clamp: this read’s page boundary is what a
caller RESUMES from, so a silently shrunk page hands back a cursor for a position the caller
did not ask about, and a caller that believed its own number would mis-size every subsequent
request. Refusing keeps the caller’s model of the page and the node’s identical, which is the
same reason a 65-hex coin id is refused rather than truncated.
limit: 0 is refused for a separate reason: a page that can hold nothing makes no progress,
so a caller looping until a page comes back short would loop forever.
Trait Implementations§
Source§impl Clone for WalletCoinsByParentParams
impl Clone for WalletCoinsByParentParams
Source§fn clone(&self) -> WalletCoinsByParentParams
fn clone(&self) -> WalletCoinsByParentParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more