forgetHash removes all traces of a block announcement from the fetcher's internal state.
(hash common.Hash)
| 693 | // forgetHash removes all traces of a block announcement from the fetcher's |
| 694 | // internal state. |
| 695 | func (f *Fetcher) forgetHash(hash common.Hash) { |
| 696 | // Remove all pending announces and decrement DOS counters |
| 697 | for _, announce := range f.announced[hash] { |
| 698 | f.announces[announce.origin]-- |
| 699 | if f.announces[announce.origin] == 0 { |
| 700 | delete(f.announces, announce.origin) |
| 701 | } |
| 702 | } |
| 703 | delete(f.announced, hash) |
| 704 | if f.announceChangeHook != nil { |
| 705 | f.announceChangeHook(hash, false) |
| 706 | } |
| 707 | // Remove any pending fetches and decrement the DOS counters |
| 708 | if announce := f.fetching[hash]; announce != nil { |
| 709 | f.announces[announce.origin]-- |
| 710 | if f.announces[announce.origin] == 0 { |
| 711 | delete(f.announces, announce.origin) |
| 712 | } |
| 713 | delete(f.fetching, hash) |
| 714 | } |
| 715 | |
| 716 | // Remove any pending completion requests and decrement the DOS counters |
| 717 | for _, announce := range f.fetched[hash] { |
| 718 | f.announces[announce.origin]-- |
| 719 | if f.announces[announce.origin] == 0 { |
| 720 | delete(f.announces, announce.origin) |
| 721 | } |
| 722 | } |
| 723 | delete(f.fetched, hash) |
| 724 | |
| 725 | // Remove any pending completions and decrement the DOS counters |
| 726 | if announce := f.completing[hash]; announce != nil { |
| 727 | f.announces[announce.origin]-- |
| 728 | if f.announces[announce.origin] == 0 { |
| 729 | delete(f.announces, announce.origin) |
| 730 | } |
| 731 | delete(f.completing, hash) |
| 732 | } |
| 733 | } |
| 734 | |
| 735 | // forgetBlock removes all traces of a queued block from the fetcher's internal |
| 736 | // state. |