pub struct WalletCoinsByParentResult {
pub coins: Vec<WalletCoinRecord>,
pub complete: bool,
pub cursor: Option<String>,
pub source: Option<WalletReadSource>,
pub synced: bool,
pub peak_height: Option<u32>,
}Expand description
control.wallet.coinsByParent — the DIRECT children created by spending one coin.
§ONE hop, never a walk
The list is the coins the named parent’s spend created, and nothing further. It is not a lineage, not a subtree, and not transitive: a grandchild appears only when the caller asks again with the child’s id. A node MUST NOT recurse — an unbounded server-side walk over caller-supplied input is work the caller cannot bound, and a partial walk returned as if complete would be a lineage with a silent hole in it.
§A page, and it says so — the truncation rule
coins is ONE PAGE of the parent’s children, bounded by
COINS_BY_PARENT_MAX_LIMIT. Whether it is the WHOLE
child set is stated by complete and never left to be inferred from the page’s
length.
This is the money-critical shape in this type. A caller walking a lineage reads “no more
children” as this branch ends here, so a page that was truncated but looks whole terminates the
walk early and presents a partial lineage as a complete one. Inferring completeness from
coins.len() < limit is NOT equivalent and MUST NOT be done: a node is free to return a short
page for its own reasons, and a child set that is an exact multiple of the page size makes the
last full page indistinguishable from a truncated one.
§Resuming: the same lesson control.wallet.arrivals records
Resume from cursor — the last child you were actually HANDED — by passing it
as after_coin_id. There is
deliberately no “where the chain got to” marker on this type to reach for instead; that is the
distinction WalletArrivalsResult::latest exists to warn about, and the cheapest way not to lose
a row to it is to give a caller nothing else to resume from.
§The order is part of the contract, because paging is meaningless without one
A node MUST return children in ASCENDING coin_id order, and MUST keep that order stable across
the pages of one walk. after_coin_id means strictly after this id in that order. Without a
fixed order a cursor names no position, and a walk would silently repeat some children and skip
others. Coin ids are fixed-length lowercase hex, so ascending lexicographic order and ascending
32-byte numeric order are the SAME order — an implementation may use whichever it has, and the
two can never disagree.
§An empty list is an ANSWER, never a fallback
coins: [] means the node consulted a chain and that parent created no children it knows of —
typically because the parent is unspent. It is NEVER what a caller gets when the chain could not
be reached: those are the catalogued errors
(WalletNoChainSource /
WalletReadFailed /
WalletRateLimited). The distinction is the
same one every read in this family carries, and it matters most here: a caller walking a
singleton forward reads an empty list as this is the tip.
§asset is null on every record
A child is named by its parent, not by an address and not by an asset, so this read classifies
nothing — exactly like WalletCoinByIdResult. Every record MUST report
asset as null rather than assert a class the read never verified.
Fields§
§coins: Vec<WalletCoinRecord>One page of the parent’s direct children, ascending by coin_id, possibly empty. One hop
only, and NOT necessarily the whole child set — see complete.
complete: boolIs this page the WHOLE child set?
true means every child the node knows of is in coins and the walk of this
hop is finished. false means the answer was TRUNCATED and more children exist — resume from
cursor.
Required on the wire, and stated positively so that the reading a caller falls into when the
field is absent or defaulted is the SAFE one. A boolean spelled truncated would default to
false, i.e. to “this is everything”, which is the claim that ends a lineage walk early;
complete defaults to “there may be more”, which costs at worst one redundant request.
cursor: Option<String>The last child in this page — the value to resume from — or null for an empty page.
It is the id the caller was HANDED, never a marker for where the chain got to. Pass it as
after_coin_id to fetch the next
page.
The key MUST be present. null is meaningful here — it says this page carried nothing — so
an ABSENT key must not decode into it: serde’s default treatment of Option would let a
truncated or mis-routed payload decode into a confident “there was nothing to resume from”.
source: Option<WalletReadSource>Which tier answered, or None from a node too old to disclose it. See WalletReadSource.
synced: boolWhether these children reflect a caught-up view of the tier that ANSWERED, measured against that tier’s own peak — never against the node’s replica or its held peers.
true only when that peak came from the SAME read that produced these figures; a carried-over
peak means false.
peak_height: Option<u32>The peak height of the tier that ANSWERED, or null when that tier tracks no peak.
It MUST be the height that tier reported in the SAME read that produced the figures, or null.
Trait Implementations§
Source§impl Clone for WalletCoinsByParentResult
impl Clone for WalletCoinsByParentResult
Source§fn clone(&self) -> WalletCoinsByParentResult
fn clone(&self) -> WalletCoinsByParentResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more