Skip to main content

compute_tx_hash

Function compute_tx_hash 

Source
pub fn compute_tx_hash<T: LighterTx>(tx: &T, chain_id: u32) -> Result<[u8; 40]>
Expand description

Compute the signed message hash for any LighterTx.

Combines the body Poseidon2 hash with the attribute hash when attributes are populated; otherwise returns the body hash directly. The 40-byte LE encoding is the venue-side tx_hash and the message PrivateKey::sign consumes.

ยงErrors

Returns an error if the transaction attributes violate venue restrictions.