pub struct WalletCoinSpend {
pub coin: WalletCoinRecord,
pub puzzle_reveal: String,
pub solution: String,
}Expand description
One coin’s SPEND: the coin that was consumed, plus the two programs that consumed it.
This is the chia CoinSpend in the contract’s own wire form — the puzzle reveal and the solution
as lowercase hex of their serialized CLVM, beside the WalletCoinRecord for the spent coin.
The coin is carried as the SAME record type the other reads use rather than a trimmed
parent/puzzle-hash/amount triple, because a second coin shape is a second thing to keep in step
with dig-app’s frozen CoinRecord (see WalletCoinRecord).
§The reveal is checkable, and a conforming node MUST have checked it
A puzzle reveal is supplied by a peer, and a lying peer can supply a different program. The
reveal’s tree hash MUST equal the spent coin’s own
puzzle_hash, which makes the claim self-checking, and a node
MUST fail closed — a catalogued error, never a spend carrying an unverified reveal — when the
hashes disagree or the reveal does not parse. A caller MAY re-derive the same check from the two
fields it is handed; it never has to trust the node to have done it.
§spent_height is present on the coin, always
A spend exists only because the coin was spent, so
spent_height MUST be non-null here. A spend reporting an
unspent coin is a contradiction the shape cannot forbid, so the contract forbids it instead.
Fields§
§coin: WalletCoinRecordThe coin this spend consumed. Its spent_height MUST be non-null (see the type docs).
puzzle_reveal: StringThe puzzle reveal: lowercase hex of the serialized CLVM program. MUST tree-hash to
coin.puzzle_hash.
solution: StringThe solution the puzzle was run with: lowercase hex of the serialized CLVM.
Trait Implementations§
Source§impl Clone for WalletCoinSpend
impl Clone for WalletCoinSpend
Source§fn clone(&self) -> WalletCoinSpend
fn clone(&self) -> WalletCoinSpend
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more