MCPcopy
hub / github.com/canopy-network/canopy / Hash

Method Hash

lib/dex.go:17–26  ·  view source on GitHub ↗

Hash() creates a hash representative of the dex batch

()

Source from the content-addressed store, hash-verified

15
16// Hash() creates a hash representative of the dex batch
17func (x *DexBatch) Hash() []byte {
18 if x == nil {
19 return bytes.Clone(EmptyReceiptsHash)
20 }
21 if x.IsEmpty() {
22 x.ReceiptHash = bytes.Clone(EmptyReceiptsHash)
23 }
24 bz, _ := Marshal(x.Copy())
25 return crypto.Hash(bz)
26}
27
28// Copy() returns a copy, omitting non-critical information
29func (x *DexBatch) Copy() *DexBatch {

Callers 5

TestDexBatch_HashFunction · 0.95
TestDexBatch_Hash_NilFunction · 0.95
TestDexDepositFunction · 0.95
TestDexWithdrawFunction · 0.95
TestDexSwapFunction · 0.95

Calls 5

IsEmptyMethod · 0.95
CopyMethod · 0.95
HashFunction · 0.92
CloneMethod · 0.80
MarshalFunction · 0.70

Tested by 5

TestDexBatch_HashFunction · 0.76
TestDexBatch_Hash_NilFunction · 0.76
TestDexDepositFunction · 0.76
TestDexWithdrawFunction · 0.76
TestDexSwapFunction · 0.76