From: Forrest Voight Date: Wed, 26 Jun 2013 17:48:18 +0000 (-0400) Subject: added new share class X-Git-Tag: 13.0^2~8 X-Git-Url: https://git.novaco.in/?p=p2pool.git;a=commitdiff_plain;h=ddc6867abf56760fa85f0826aa36cb10ac7c8360 added new share class --- diff --git a/p2pool/data.py b/p2pool/data.py index 4c20b7f..27c72e3 100644 --- a/p2pool/data.py +++ b/p2pool/data.py @@ -41,19 +41,21 @@ share_type = pack.ComposedType([ def load_share(share, net, peer_addr): assert peer_addr is None or isinstance(peer_addr, tuple) - if share['type'] in [0, 1, 2, 3, 4, 5, 6, 7, 8]: + if share['type'] < Share.VERSION: from p2pool import p2p raise p2p.PeerMisbehavingError('sent an obsolete share') elif share['type'] == Share.VERSION: return Share(net, peer_addr, Share.share_type.unpack(share['contents'])) + elif share['type'] == NewShare.VERSION: + return NewShare(net, peer_addr, NewShare.share_type.unpack(share['contents'])) else: raise ValueError('unknown share type: %r' % (share['type'],)) DONATION_SCRIPT = '4104ffd03de44a6e11b9917f3a29f9443283d9871c9d743ef30d5eddcd37094b64d1b3d8090496b53256786bf5c82932ec23c3b74d9f05a6f95a8b5529352656664bac'.decode('hex') -class Share(object): - VERSION = 9 - VOTING_VERSION = 11 +class NewShare(object): + VERSION = 13 + VOTING_VERSION = 13 SUCCESSOR = None small_block_header_type = pack.ComposedType([ @@ -369,7 +371,7 @@ class Share(object): class Share(object): VERSION = 9 VOTING_VERSION = 11 - SUCCESSOR = None + SUCCESSOR = NewShare small_block_header_type = pack.ComposedType([ ('version', pack.VarIntType()),