Skip to content

Commit dae21de

Browse files
authored
Fixping (#38)
* Higher ping interval, don't broadcast per connection * Remove log files
1 parent 4cbd168 commit dae21de

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

config/config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
network_id: testnet # testnet/mainnet
22
# Send a ping to all peers after ping_interval seconds
3-
ping_interval: 120
3+
ping_interval: 300
44
# Close the connection if no data is received for timeout_duration seconds.
55
# Must be greater than ping_interval
6-
timeout_duration: 600
6+
timeout_duration: 3000
77

88
harvester:
99
# The harvester server (if run) will run on this host and port

src/consensus/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
"NUMBER_OF_TIMESTAMPS": 11, # Than the average of the last NUMBEBR_OF_TIMESTAMPS blocks
2020
# If an unfinished block is more than these many seconds slower than the best unfinished block,
2121
# don't propagate it.
22-
"PROPAGATION_THRESHOLD": 150,
22+
"PROPAGATION_THRESHOLD": 300,
2323
# If the expected time is more than these seconds, slightly delay the propagation of the unfinished
2424
# block, to allow better leaders to be released first. This is a slow block.
25-
"PROPAGATION_DELAY_THRESHOLD": 120,
25+
"PROPAGATION_DELAY_THRESHOLD": 1500,
2626
# Hardcoded genesis block, generated using tests/block_tools.py
2727
# Replace this any time the above constants change.
2828
"GENESIS_BLOCK": b"\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x15N3\xd3\xf9H\xc2K\x96\xfe\xf2f\xa2\xbf\x87\x0e\x0f,\xd0\xd4\x0f6s\xb1\".\\\xf5\x8a\xb4\x03\x84\x8e\xf9\xbb\xa1\xca\xdef3:\xe4?\x0c\xe5\xc6\x12\x80\x17\xd2\xcc\xd7\xb4m\x94\xb7V\x959\xed4\x89\x04b\x08\x07^\xca`\x8f#%\xe9\x9c\x9d\x86y\x10\x96W\x9d\xce\xc1\x15r\x97\x91U\n\x11<\xdf\xb2\xfc\xfb<\x13\x00\x00\x00\x98\x97N\xe3py\xb5*\xe8\xbe_\xa5\xa5mq\xceY\x08$;\xe1\xef;:\xc0\x93\x84\xa6(`\xe7\xf1\x0b\xb6\x08\xb4\xa1\xc7\x03\xe5v\xb9)\xd2\xc9|\t\xcc\xb3\xd4\x05\xd9-\xa2;\xeb\xdd!\xd1\\Oh<\x01+\x9e\xbfK\xe3y\xd8\xd0T\xac\xb52+Zj+)\xad\xabIg\x82\x998\xe5\x86\xa3[\xd1\xc1\xe9\x9dD\xbb\xe2IN\x01\xdc\x1e\xcc\t\x1c\xa7\xe4\xb92\x98^\xd5\xd6\xce\xe1Z\xcd\x9e\xee\xba\x9f,\x94B?}\xf7\xeb\x8f,\xbds\xc4g\x02\"}\x88\x17.\xf7\xd3\x89\x15Vi\xbe2\xdct\xc4\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x02M\xf9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c#\xc2\xe9\x12\xd5I\xc1v\x07H\xa1\x90\xe7\xcaE\xfb\xe1d\xbd\x05=\x95\x14\xd15O\xb6\xed;\x00\xa4\xba!\xb99\xab\x89\xae\xa5\x96e\xf9\xd2D\x1c\xa8\xd9H\xb3\x15*\xa8\xdc\xc5\x89\xf9q\xc2J9\x01F\xd6\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xeb\x1e*\xda3k\x83\x83\xa6\xc9a\x83O\xfcM\x14\xd5E\x81Ob\x7fxW`A?\x06t\x8a\xf0\xf4n\xde\x9e\x9eHP\xd9\xd3rL\xebe-\xab\x96H\xdd\xeb\x8e\xea-\xeccL+\x1fF\xa7L\xdfy/\x03\x00\x00\x03\xa6\x00>\x93\x89\x7f\tiBhT\xa0\x90\x81\x93y\xb3\xe8#\xdb#\xfe(t\xc3\xd4b\x80\x0b\xceE\xd1r\xcc\xaag\x97\"\xfd\xcc\x99\xbbr\xea\x95\x9c\xb1\x16\x05K\xf0\x98\xd8j\x06P\xa2m\xc8\x8a\x1a\xe6\xf8\xed \xbb\xff\xd9\xf7*\xf9m\x16\xf1\x80j\xa2\xe9\xcb&S\x0e\x95\xeb\xe4W\xa6\xb0\x14\xd1Q\x9b\xc9vs\x07\x90.\x82#\xc5\\I\x0f\xfe\xd5%h\xf8{KsC\xa7\xb5T\xe2\x0fud7y\x8a\x01dK\x0e\x0b\x95\x13\xd3\x00\x00\x00\x00\x00\x00\x0c\xa5\x00\x03$Gm\xc3\x01\xcbm\x19N(P\xf3\xa5T\x87G\xae\x97\xde\x9f[\x86\x9c\x9d\xd2\x1b\x91\x9a{%\xb1\xf4c\xd4\x03\x84\"\xd8?\x96\xa6\xa5\x94\x1cYg\xcfb(\xf2\x94V\x8b\x14\x84\x86NR\x1d'\xcd\xe8{\xff\xff\xc6\x00\x82\x8b]'\x19)\x05\xad\xb7k\x90\x07u\xae\xe2\xbc\xbf$H\xcf5l\xf4M\xca\xc6\x8bW\xcc\xf2\xbd>\xaa\n\x02\x07\x13\xe9\xb5p-\xbc\x8c\xbb\xa8\x91\xc8\xbe\xfc\x01n\xd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0\x1b\xd0\x83\x00\x00\x00\x00\x00\x01\xf9\xb0\x00K\xda\x15\x12\x84\xa4\x99\x88\xa4,\xb6\xba$\xaaH\xee\x8cq\xfd\xde\xf1\t\xac\x81'\xb8\r\x90\x96\xa3\x10\xefx\xae\x19s\xd9\xad\xdc\x10\xb34\x1d\x16i\x8bO\x8bv\x86\x98VjUt8\x1e`\xb91.I\x07\xda\xff\xed\xe6\x9f[\xe2\x16\x0c\xe9\xb7\xbc\x95\x916\x96\xd5=Z:\xe6\x80\x0b\x903\xd8%\xa8ApE\xc7\xaa\x0f\xde\xc5\xe0\xf0\x82\xf47\xc4\xc9\x9a\xff\x9aAB\xf5\x07\x0cX\xa3\xe3\x89\xc8'\xc3\xfd\xc9\xd4\x93\xa9\xacD\xe5\x00\x06\x97\x1a\xf8\xa4\xd4\xac\x8b\t\xad\x0b\xb7.\xb4\xd3P\xc3;\x8b!\xcb\xbaY\xc6\xa7\xcd\xbc\xd3\x1b\x00\x87E\x9e>\xa6$\x00\xb4l\xfa\xdf\xaf\x03_\xb9\xfd\xb8\xf4\xae\x91y\x01K9\xb7\xc8t\x97\t\xdb\xc4k\xda\x9e\xff\xfc\xf3\xbbs\x10\xd7'\xc9\xaa\xa3cq\x0f\x95\xb4\xc1\x83\xb7\x85\xe9(\xac\x83BDl\x05\xeeX\xb0\x87\xd4\xcd\x1f\xcc\x03`\x8d\x9cg\n\x8c\x15\x95\xc6:\x8e\x97\xe5\xc8\xeeO\x01\x93\xa6\x8e\xdbk\xef\x1ex\x8b\x12\xa5\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\xa7\xb0\x1a\xba$sST\x96\xa9[\xc1\xb2\x08\xbe5\xb41\x89\x8f\x19<\x18\x1db\x01!wG\x82\xc2\xb8\x0f:%R\xd3K\x08\xb4,\x81\xd1\nZx\xdeB\xd2\xa0\n\xac9>\x18\xf9\xf2e;\xe0\x06\x8eh6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x13\x88\x00\x00\x00\x00\x00\x02M\xf9\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00]\xe7\x07\x8e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa7\xb0\x1a\xba$sST\x96\xa9[\xc1\xb2\x08\xbe5\xb41\x89\x8f\x19<\x18\x1db\x01!wG\x82\xc2\xb8j\xd3\xea\x06\xad\xca\x97\x9f\x00\xcd\xea\xb8Dz+\x93\xbe\xd6\x165\xc4\x86\x07[%\x1e\x12g\x1f\x1f\x8b\xa6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd7\x95\xcf\xb2\xd6\xac\x04J\xdb~\xb6\xc3\xa4\x06E\x07H\xae\xf8~\xde\x8c\xa4\x9c\x8b\x7f\x018fK\xfd%I3\x13g\xdd\xb8\x9f=M\xa3\x8c\x8aJj\xc5B\x08!CLv\xc0\xe5m\xfb\x82W\xb1\x93\x1eL\\\x9ca\x15\xb9\xc2\xb4\x08\xc1\xf9@\x7f|\x9f78\xae\xbe\xcc\xe0[\x84O`\xb0\xdfoG'u`\xc7\xc9\x00\x00\x00\x00\x00\x00\x0e\x8dJQ\x00\x00\x8b)\xaa\x96x8\xd76J\xa6\x8b[\x98\t\xe0\\\xe3^7qD\x8c\xf5q\x08\xf2\xa2\xc9\xb03mv@s\xf3\xb1b\x05\r&'Y\xc7{\xb2rnI\x87\x94\xd7%-&\x162\\\xc0S\xbf\xe5\xe0\xc5\xb1\x8e\xe4OaB\x91\xdc\xf8\xb1r\xc8B\xd0\xa9\x8e\xbc\x13\x1b=$\x90;q\x05\xa7 \xd6\xdd\xda\x8fQ\x1c\x00\xa8&v\xb2\xc61\x94\xfc\x0c\x9fu\x83\xcd\x05.\x17\x1fU6 \x05k\xcd\xd7\"\xef\xb35\xff\x0f\x81\x8b)\xaa\x96x8\xd76J\xa6\x8b[\x98\t\xe0\\\xe3^7qD\x8c\xf5q\x08\xf2\xa2\xc9\xb03mv\x00\x00\x00\x00\x00\x00\x00\x00\x00_\xec\xebf\xff\xc8o8\xd9Rxlmily\xc2\xdb\xc29\xddN\x91\xb4g)\xd7:'\xfbW\xe9\x00\x00\x00\x00\x00\x00\x00\x00", # noqa: E501

src/server/server.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -178,19 +178,6 @@ async def ping():
178178
to_close: List[Connection] = []
179179
for connection in self.global_connections.get_connections():
180180
if connection.handshake_finished:
181-
msg = Message("ping", Ping(bytes32(token_bytes(32))))
182-
self.push_message(
183-
OutboundMessage(NodeType.FARMER, msg, Delivery.BROADCAST)
184-
)
185-
self.push_message(
186-
OutboundMessage(NodeType.TIMELORD, msg, Delivery.BROADCAST)
187-
)
188-
self.push_message(
189-
OutboundMessage(NodeType.FULL_NODE, msg, Delivery.BROADCAST)
190-
)
191-
self.push_message(
192-
OutboundMessage(NodeType.HARVESTER, msg, Delivery.BROADCAST)
193-
)
194181
if (
195182
time.time() - connection.get_last_message_time()
196183
> config["timeout_duration"]
@@ -202,6 +189,19 @@ async def ping():
202189
for connection in to_close:
203190
log.info(f"Removing connection {connection} due to timeout.")
204191
self.global_connections.close(connection)
192+
msg = Message("ping", Ping(bytes32(token_bytes(32))))
193+
self.push_message(
194+
OutboundMessage(NodeType.FARMER, msg, Delivery.BROADCAST)
195+
)
196+
self.push_message(
197+
OutboundMessage(NodeType.TIMELORD, msg, Delivery.BROADCAST)
198+
)
199+
self.push_message(
200+
OutboundMessage(NodeType.FULL_NODE, msg, Delivery.BROADCAST)
201+
)
202+
self.push_message(
203+
OutboundMessage(NodeType.HARVESTER, msg, Delivery.BROADCAST)
204+
)
205205
await asyncio.sleep(config["ping_interval"])
206206

207207
return asyncio.create_task(ping())

0 commit comments

Comments
 (0)