Skip to content

Commit 95af3a8

Browse files
committed
Renamed dandelion flag to dandelion_enabled
1 parent 1c8ae8f commit 95af3a8

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

src/bitmessagemain.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,12 @@ def start(self):
156156

157157
set_thread_name("PyBitmessage")
158158

159-
state.dandelion = config.safeGetInt('network', 'dandelion')
159+
state.dandelion_enabled = config.safeGetInt('network', 'dandelion')
160160
# dandelion requires outbound connections, without them,
161161
# stem objects will get stuck forever
162-
if state.dandelion and not config.safeGetBoolean(
162+
if state.dandelion_enabled and not config.safeGetBoolean(
163163
'bitmessagesettings', 'sendoutgoingconnections'):
164-
state.dandelion = 0
164+
state.dandelion_enabled = 0
165165

166166
if state.testmode or config.safeGetBoolean(
167167
'bitmessagesettings', 'extralowdifficulty'):

src/network/bmproto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ def _command_inv(self, dandelion=False):
350350
raise BMProtoExcessiveDataError()
351351

352352
# ignore dinv if dandelion turned off
353-
if dandelion and not state.dandelion:
353+
if dandelion and not state.dandelion_enabled:
354354
return True
355355

356356
for i in map(str, items):

src/network/dandelion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def poissonTimeout(start=None, average=0):
4949

5050
def addHash(self, hashId, source=None, stream=1):
5151
"""Add inventory vector to dandelion stem"""
52-
if not state.dandelion:
52+
if not state.dandelion_enabled:
5353
return
5454
with self.lock:
5555
self.hashMap[hashId] = Stem(

src/network/invthread.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def handleLocallyGenerated(stream, hashId):
4141
"""Locally generated inventory items require special handling"""
4242
state.Dandelion.addHash(hashId, stream=stream)
4343
for connection in BMConnectionPool().connections():
44-
if state.dandelion and connection != \
44+
if state.dandelion_enabled and connection != \
4545
state.Dandelion.objectChildStem(hashId):
4646
continue
4747
connection.objectsNewToThem[hashId] = time()
@@ -77,7 +77,7 @@ def run(self): # pylint: disable=too-many-branches
7777
if connection == state.Dandelion.objectChildStem(inv[1]):
7878
# Fluff trigger by RNG
7979
# auto-ignore if config set to 0, i.e. dandelion is off
80-
if random.randint(1, 100) >= state.dandelion: # nosec B311
80+
if random.randint(1, 100) >= state.dandelion_enabled: # nosec B311
8181
fluffs.append(inv[1])
8282
# send a dinv only if the stem node supports dandelion
8383
elif connection.services & protocol.NODE_DANDELION > 0:

src/protocol.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ def assembleVersionMessage(
351351
'>q',
352352
NODE_NETWORK
353353
| (NODE_SSL if haveSSL(server) else 0)
354-
| (NODE_DANDELION if state.dandelion else 0)
354+
| (NODE_DANDELION if state.dandelion_enabled else 0)
355355
)
356356
payload += pack('>q', int(time.time()))
357357

@@ -375,7 +375,7 @@ def assembleVersionMessage(
375375
'>q',
376376
NODE_NETWORK
377377
| (NODE_SSL if haveSSL(server) else 0)
378-
| (NODE_DANDELION if state.dandelion else 0)
378+
| (NODE_DANDELION if state.dandelion_enabled else 0)
379379
)
380380
# = 127.0.0.1. This will be ignored by the remote host.
381381
# The actual remote connected IP will be used.

src/state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
discoveredPeers = {}
4646

47-
dandelion = 0
47+
dandelion_enabled = 0
4848

4949
kivy = False
5050

src/tests/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def test_version(self):
324324
decoded = self._decode_msg(msg, "IQQiiQlsLv")
325325
peer, _, ua, streams = self._decode_msg(msg, "IQQiiQlsLv")[4:]
326326
self.assertEqual(
327-
peer, Node(11 if state.dandelion else 3, '127.0.0.1', 8444))
327+
peer, Node(11 if state.dandelion_enabled else 3, '127.0.0.1', 8444))
328328
self.assertEqual(ua, '/PyBitmessage:' + softwareVersion + '/')
329329
self.assertEqual(streams, [1])
330330
# with multiple streams

0 commit comments

Comments
 (0)