Skip to content

Broadcast to 0 peers on nil peers arg

Christopher Schinnerl requested to merge gateway-fixes into master

Created by: VoidingWarranties

It was too easy to write bugs where the gateway to broadcast to all peers if no peers matched the filtering criteria. For example the following would broadcast to all peers if there were no peers >=v0.4.7

var v047AndAbove []modules.Peer
for _, p := range tp.gateway.Peers() {
        if build.VersionCmp(p.Version, "0.4.7") >= 0 {
                v047AndAbove = append(v047AndAbove, p)
        }
}
go tp.gateway.Broadcast("RelayTransactionSet", ts, v047AndAbove)

Also add the connection address to the log output when an RPC fails

Merge request reports