File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ func (c *Chain) Head() *Block {
8080}
8181
8282func (c * Chain ) Blocks () []* Block {
83+ // TODO: this lock is pointless
8384 c .mu .Lock ()
8485 defer c .mu .Unlock ()
8586 return c .blocks
Original file line number Diff line number Diff line change @@ -378,8 +378,14 @@ func (m *Monitor) broadcast(events Blocks) {
378378 return
379379 }
380380
381+ head := m .chain .Head ()
382+
381383 if m .sentBlockNumber == nil {
382- m .sentBlockNumber = big .NewInt (0 ).SetUint64 (m .chain .Head ().NumberU64 () - uint64 (numBlocksBehindHead ))
384+ m .sentBlockNumber = big .NewInt (0 ).Sub (head .Number (), big .NewInt (int64 (numBlocksBehindHead + 1 )))
385+ }
386+
387+ if big .NewInt (0 ).Sub (head .Number (), m .sentBlockNumber ).Cmp (big .NewInt (int64 (numBlocksBehindHead ))) < 0 {
388+ return
383389 } else {
384390 m .sentBlockNumber = big .NewInt (0 ).Add (m .sentBlockNumber , big .NewInt (1 ))
385391 }
You can’t perform that action at this time.
0 commit comments