MCPcopy Create free account
hub / github.com/BitVM/BitVM / mid_state_txid

Method mid_state_txid

final-spv/src/transaction.rs:35–54  ·  view source on GitHub ↗

Returns the first digest of the transaction to be used in SPV

(&self)

Source from the content-addressed store, hash-verified

33
34 /// Returns the first digest of the transaction to be used in SPV
35 pub fn mid_state_txid(&self) -> [u8; 32] {
36 let mut tx_bytes_vec = vec![];
37 self.inner()
38 .version
39 .consensus_encode(&mut tx_bytes_vec)
40 .unwrap();
41 self.inner()
42 .input
43 .consensus_encode(&mut tx_bytes_vec)
44 .unwrap();
45 self.inner()
46 .output
47 .consensus_encode(&mut tx_bytes_vec)
48 .unwrap();
49 self.inner()
50 .lock_time
51 .consensus_encode(&mut tx_bytes_vec)
52 .unwrap();
53 calculate_sha256(&tx_bytes_vec)
54 }
55}
56
57impl BorshSerialize for CircuitTransaction {

Callers 2

new_mid_stateMethod · 0.80
txidMethod · 0.80

Calls 2

innerMethod · 0.80
calculate_sha256Function · 0.70

Tested by

no test coverage detected