X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=p2pool%2Fp2p.py;h=f11d2d67d6b4a577ff8f0fe2bba6e25ff712f9e8;hb=d874cb70;hp=bc61982eca3c0548e4f19aa7f18d6fef705230c9;hpb=9541a77695bc98cccff001541ccb3880bca6d875;p=p2pool.git diff --git a/p2pool/p2p.py b/p2pool/p2p.py index bc61982..f11d2d6 100644 --- a/p2pool/p2p.py +++ b/p2pool/p2p.py @@ -25,6 +25,8 @@ def fragment(f, **kwargs): fragment(f, **dict((k, v[len(v)//2:]) for k, v in kwargs.iteritems())) class Protocol(p2protocol.Protocol): + VERSION = 1300 + max_remembered_txs_size = 2500000 def __init__(self, node, incoming): @@ -43,7 +45,7 @@ class Protocol(p2protocol.Protocol): self.addr = self.transport.getPeer().host, self.transport.getPeer().port self.send_version( - version=1300, + version=self.VERSION, services=0, addr_to=dict( services=0, @@ -254,7 +256,7 @@ class Protocol(p2protocol.Protocol): def handle_shares(self, shares): result = [] for wrappedshare in shares: - if wrappedshare['type'] < 9: continue + if wrappedshare['type'] < p2pool_data.Share.VERSION: continue share = p2pool_data.load_share(wrappedshare, self.node.net, self.addr) if wrappedshare['type'] >= 13: txs = [] @@ -328,11 +330,12 @@ class Protocol(p2protocol.Protocol): ('result', pack.EnumType(pack.VarIntType(), {0: 'good', 1: 'too long', 2: 'unk2', 3: 'unk3', 4: 'unk4', 5: 'unk5', 6: 'unk6'})), ('shares', pack.ListType(p2pool_data.share_type)), ]) + class ShareReplyError(Exception): pass def handle_sharereply(self, id, result, shares): if result == 'good': - res = [p2pool_data.load_share(share, self.node.net, self.addr) for share in shares if share['type'] >= 9] + res = [p2pool_data.load_share(share, self.node.net, self.addr) for share in shares if share['type'] >= p2pool_data.Share.VERSION] else: - res = failure.Failure("sharereply result: " + result) + res = failure.Failure(self.ShareReplyError(result)) self.get_shares.got_response(id, res)