diff options
| author | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-10-22 20:15:40 +0200 | 
|---|---|---|
| committer | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-10-22 20:15:40 +0200 | 
| commit | 6bd17ab810ec1eaa1f93ef7136ee4008337a2f14 (patch) | |
| tree | 735d2513e83bdb67af637d01be56884c3f329a99 | |
| parent | e049d303d911b02d7505214e56744f21437f3916 (diff) | |
attached InclusionProofV1 onto StItem
| -rw-r--r-- | type.go | 20 | 
1 files changed, 12 insertions, 8 deletions
| @@ -44,8 +44,9 @@ func (f StFormat) String() string {  // StItem references a versioned item based on a given format specifier.  type StItem struct { -	Format     StFormat    `tls:"maxval:65535"` -	ChecksumV1 *ChecksumV1 `tls:"selector:Format,val:5"` +	Format           StFormat          `tls:"maxval:65535"` +	InclusionProofV1 *InclusionProofV1 `tls:"selector:Format,val:4"` +	ChecksumV1       *ChecksumV1       `tls:"selector:Format,val:5"`  	// TODO: add more items  } @@ -106,17 +107,20 @@ type InclusionProofV1 struct {  	InclusionPath []NodeHash `tls:"minlen:1,maxlen:65535"`  } -func NewInclusionProofV1(logID []byte, treeSize uint64, proof *trillian.Proof) InclusionProofV1 { +func NewInclusionProofV1(logID []byte, treeSize uint64, proof *trillian.Proof) StItem {  	inclusionPath := make([]NodeHash, 0, len(proof.Hashes))  	for _, hash := range proof.Hashes {  		inclusionPath = append(inclusionPath, NodeHash{Data: hash})  	} -	return InclusionProofV1{ -		LogID:         logID, -		TreeSize:      treeSize, -		LeafIndex:     uint64(proof.LeafIndex), -		InclusionPath: inclusionPath, +	return StItem{ +		Format: StFormatInclusionProofV1, +		InclusionProofV1: &InclusionProofV1{ +			LogID:         logID, +			TreeSize:      treeSize, +			LeafIndex:     uint64(proof.LeafIndex), +			InclusionPath: inclusionPath, +		},  	}  } | 
