File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -74,15 +74,18 @@ void RemotePeer::Impl::DoneGetSTH(
7474 LogVerifier::VERIFY_OK)
7575 << " could not validate STH:\n " << new_sth->DebugString ();
7676
77- lock_guard<mutex> lock (lock_);
77+ // TODO(alcutter): Need to check STH consistency here, including for older
78+ // STHs which might come in.
7879
79- if (sth_) {
80- CHECK_GE (new_sth->tree_size (), sth_->tree_size ());
81- } else {
82- CHECK_GE (new_sth->tree_size (), 0 );
83- }
80+ lock_guard<mutex> lock (lock_);
8481
85- if (!sth_ || new_sth->timestamp () > sth_->timestamp ()) {
82+ if (new_sth->tree_size () < 0 ) {
83+ LOG (WARNING) << " Unexpected tree size in new_sth:\n "
84+ << new_sth->DebugString ();
85+ } else if (sth_ && new_sth->tree_size () < sth_->tree_size ()) {
86+ LOG (WARNING) << " Received old STH:\n " << new_sth->DebugString ();
87+ } else if (!sth_ || new_sth->timestamp () > sth_->timestamp ()) {
88+ // This STH is good, we'll take it.
8689 sth_ = new_sth;
8790 if (on_new_sth_) {
8891 on_new_sth_ (*sth_);
You can’t perform that action at this time.
0 commit comments