Commit 7550853e authored by zhiqiangxu's avatar zhiqiangxu Committed by GitHub

Check `bcast.From` correctly (#12941)

* ensure bcast.From == mgr.From()

* address comment

* fix for create2
parent 914157f9
......@@ -90,6 +90,9 @@ func NewKeyedBroadcaster(cfg KeyedBroadcasterOpts) (*KeyedBroadcaster, error) {
}
func (t *KeyedBroadcaster) Hook(bcast script.Broadcast) {
if bcast.Type != script.BroadcastCreate2 && bcast.From != t.mgr.From() {
panic(fmt.Sprintf("invalid from for broadcast:%v, expected:%v", bcast.From, t.mgr.From()))
}
t.mtx.Lock()
t.bcasts = append(t.bcasts, bcast)
t.mtx.Unlock()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment