Skip to content

Commit

Permalink
p2p/discv5: fix removeTicketRef cached ticket removal (ethereum#15995)
Browse files Browse the repository at this point in the history
  • Loading branch information
zsfelfoldi authored and karalabe committed Jan 30, 2018
1 parent a9e4a90 commit 6198c53
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions p2p/discv5/ticket.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,14 @@ func (s *ticketStore) nextRegisterableTicket() (*ticketRef, time.Duration) {
func (s *ticketStore) removeTicketRef(ref ticketRef) {
log.Trace("Removing discovery ticket reference", "node", ref.t.node.ID, "serial", ref.t.serial)

// Make nextRegisterableTicket return the next available ticket.
s.nextTicketCached = nil

topic := ref.topic()
tickets := s.tickets[topic]

if tickets == nil {
log.Warn("Removing tickets from unknown topic", "topic", topic)
log.Trace("Removing tickets from unknown topic", "topic", topic)
return
}
bucket := timeBucket(ref.t.regTime[ref.idx] / mclock.AbsTime(ticketTimeBucketLen))
Expand All @@ -450,9 +453,6 @@ func (s *ticketStore) removeTicketRef(ref ticketRef) {
delete(s.nodes, ref.t.node)
delete(s.nodeLastReq, ref.t.node)
}

// Make nextRegisterableTicket return the next available ticket.
s.nextTicketCached = nil
}

type lookupInfo struct {
Expand Down

0 comments on commit 6198c53

Please sign in to comment.