Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved protocol to network module #2258

Open
wants to merge 1 commit into
base: v0.6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@

import helper_inbox
import helper_sent
import protocol
import proofofwork
import queues
import shared

import shutdown
import state
import network.protocol as protocol
from addresses import (
addBMIfNotPresent,
decodeAddress,
Expand Down
2 changes: 1 addition & 1 deletion src/class_objectProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
import helper_sent
import highlevelcrypto
import l10n
import protocol
import queues
import shared
import state
import network.protocol as protocol
from addresses import (
decodeAddress, decodeVarint,
encodeAddress, encodeVarint, varintDecodeError
Expand Down
2 changes: 1 addition & 1 deletion src/class_singleWorker.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import highlevelcrypto
import l10n
import proofofwork
import protocol
import queues
import shared
import state
import tr
import network.protocol as protocol
from addresses import decodeAddress, decodeVarint, encodeVarint
from bmconfigparser import config
from helper_sql import sqlExecute, sqlQuery
Expand Down
2 changes: 1 addition & 1 deletion src/network/bmobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import logging
import time

import protocol
import state
import protocol
import connectionpool
from network import dandelion_ins
from highlevelcrypto import calculateInventoryHash
Expand Down
2 changes: 1 addition & 1 deletion src/network/bmproto.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
# magic imports!
import addresses
import knownnodes
import protocol
import state
import connectionpool
import protocol
from bmconfigparser import config
from queues import invQueue, objectProcessorQueue, portCheckerQueue
from randomtrackingdict import RandomTrackingDict
Expand Down
2 changes: 1 addition & 1 deletion src/network/connectionchooser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import random

import knownnodes
import protocol
import state
import protocol
from bmconfigparser import config
from queues import queue, portCheckerQueue

Expand Down
30 changes: 20 additions & 10 deletions src/protocol.py → src/network/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,26 @@
from binascii import hexlify
from struct import Struct, pack, unpack

import defaults
import highlevelcrypto
import state
from addresses import (
encodeVarint, decodeVarint, decodeAddress, varintDecodeError)
from bmconfigparser import config
from debug import logger
from helper_sql import sqlExecute
from network.node import Peer
from version import softwareVersion
try:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this isn't the best approach after all. Let's close it for now.

import defaults
import highlevelcrypto
import state
from addresses import (
encodeVarint, decodeVarint, decodeAddress, varintDecodeError)
from bmconfigparser import config
from debug import logger
from helper_sql import sqlExecute
from version import softwareVersion
except ImportError:
from pybitmessage import defaults, highlevelcrypto, state
from pybitmessage.addresses import (
encodeVarint, decodeVarint, decodeAddress, varintDecodeError)
from pybitmessage.bmconfigparser import config
from pybitmessage.debug import logger
from pybitmessage.helper_sql import sqlExecute
from pybitmessage.version import softwareVersion

from .node import Peer

# Network constants
magic = 0xE9BEB4D9
Expand Down
2 changes: 1 addition & 1 deletion src/tests/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
import time
import unittest

import protocol
import state
import helper_sent
import helper_addressbook
import network.protocol as protocol

from bmconfigparser import config
from helper_msgcoding import MsgEncode, MsgDecode
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_api_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from six.moves import queue, xmlrpc_client

from pybitmessage import protocol
from pybitmessage.network import protocol
from pybitmessage.highlevelcrypto import calculateInventoryHash

from .partial import TestPartialRun
Expand Down
3 changes: 2 additions & 1 deletion src/tests/test_packets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from binascii import unhexlify
from struct import pack

from pybitmessage import addresses, protocol
from pybitmessage import addresses
from pybitmessage.network import protocol

from .samples import (
sample_addr_data, sample_object_data, sample_object_expires)
Expand Down
3 changes: 2 additions & 1 deletion src/tests/test_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import sys
import unittest

from pybitmessage import protocol, state
from pybitmessage import state
from pybitmessage.network import protocol
from pybitmessage.helper_startup import fixSocket


Expand Down