mirror of
https://github.com/SSLMate/certspotter.git
synced 2025-06-27 10:15:33 +02:00
Also check timestamp when comparing STHs
otherwise we might fail to delete unverified_sths if they have a different timestamp
This commit is contained in:
parent
90ead642b0
commit
694eb276a6
@ -31,3 +31,7 @@ type GossipedSignedTreeHead struct {
|
|||||||
func (sth *SignedTreeHead) TimestampTime() time.Time {
|
func (sth *SignedTreeHead) TimestampTime() time.Time {
|
||||||
return time.UnixMilli(int64(sth.Timestamp))
|
return time.UnixMilli(int64(sth.Timestamp))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (sth *SignedTreeHead) Same(other *SignedTreeHead) bool {
|
||||||
|
return sth.TreeSize == other.TreeSize && sth.Timestamp == other.Timestamp && sth.RootHash == other.RootHash
|
||||||
|
}
|
||||||
|
@ -357,7 +357,7 @@ func newBatch(number uint64, begin uint64, sths []*StoredSTH, downloadJobSize ui
|
|||||||
func appendSTH(sths []*StoredSTH, sth *StoredSTH) []*StoredSTH {
|
func appendSTH(sths []*StoredSTH, sth *StoredSTH) []*StoredSTH {
|
||||||
i := len(sths)
|
i := len(sths)
|
||||||
for i > 0 {
|
for i > 0 {
|
||||||
if sths[i-1].TreeSize == sth.TreeSize && sths[i-1].RootHash == sth.RootHash {
|
if sths[i-1].Same(&sth.SignedTreeHead) {
|
||||||
return sths
|
return sths
|
||||||
}
|
}
|
||||||
if sths[i-1].TreeSize < sth.TreeSize {
|
if sths[i-1].TreeSize < sth.TreeSize {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user