Exit RelayTransaction early if we have no nodes to relay to

This commit is contained in:
Duke Leto
2022-09-06 10:08:24 -04:00
parent 55703fdb95
commit 456cf77b65

View File

@@ -2109,6 +2109,12 @@ void RelayTransaction(const CTransaction& tx, const CDataStream& ss)
auto vRelayNodes = vNodes;
// If we have no nodes to relay to, there is nothing to do
if(vNodes.size() == 0) {
fprintf(stderr, "%s: No nodes to relay to!\n", __func__ );
return;
}
// We always round down, except when we have only 1 connection
auto newSize = (vNodes.size() / 2) == 0 ? 1 : (vNodes.size() / 2);