def write(self, file, item):
return self._inner.write(file, item._bits)
-class PossiblyNone(Type):
+class PossiblyNoneType(Type):
def __init__(self, none_value, inner):
self.none_value = none_value
self.inner = inner
tx_type = ComposedType([
('version', StructType('<I')),
('tx_ins', ListType(ComposedType([
- ('previous_output', PossiblyNone(dict(hash=0, index=2**32 - 1), ComposedType([
+ ('previous_output', PossiblyNoneType(dict(hash=0, index=2**32 - 1), ComposedType([
('hash', HashType()),
('index', StructType('<I')),
]))),
('script', VarStrType()),
- ('sequence', PossiblyNone(2**32 - 1, StructType('<I'))),
+ ('sequence', PossiblyNoneType(2**32 - 1, StructType('<I'))),
]))),
('tx_outs', ListType(ComposedType([
('value', StructType('<Q')),
block_header_type = ComposedType([
('version', StructType('<I')),
- ('previous_block', PossiblyNone(0, HashType())),
+ ('previous_block', PossiblyNoneType(0, HashType())),
('merkle_root', HashType()),
('timestamp', StructType('<I')),
('target', FloatingIntegerType()),
message_getblocks = bitcoin_data.ComposedType([
('version', bitcoin_data.StructType('<I')),
('have', bitcoin_data.ListType(bitcoin_data.HashType())),
- ('last', bitcoin_data.PossiblyNone(0, bitcoin_data.HashType())),
+ ('last', bitcoin_data.PossiblyNoneType(0, bitcoin_data.HashType())),
])
message_getheaders = bitcoin_data.ComposedType([
('version', bitcoin_data.StructType('<I')),
('have', bitcoin_data.ListType(bitcoin_data.HashType())),
- ('last', bitcoin_data.PossiblyNone(0, bitcoin_data.HashType())),
+ ('last', bitcoin_data.PossiblyNoneType(0, bitcoin_data.HashType())),
])
message_getaddr = bitcoin_data.ComposedType([])
message_checkorder = bitcoin_data.ComposedType([
message_reply = bitcoin_data.ComposedType([
('hash', bitcoin_data.HashType()),
('reply', bitcoin_data.EnumType(bitcoin_data.StructType('<I'), {'success': 0, 'failure': 1, 'denied': 2})),
- ('script', bitcoin_data.PossiblyNone('', bitcoin_data.VarStrType())),
+ ('script', bitcoin_data.PossiblyNoneType('', bitcoin_data.VarStrType())),
])
def handle_reply(self, hash, reply, script):
self.check_order.got_response(hash, dict(reply=reply, script=script))
share_data_type = bitcoin_data.ComposedType([
- ('previous_share_hash', bitcoin_data.PossiblyNone(0, bitcoin_data.HashType())),
+ ('previous_share_hash', bitcoin_data.PossiblyNoneType(0, bitcoin_data.HashType())),
('target', bitcoin_data.FloatingIntegerType()),
('nonce', bitcoin_data.VarStrType()),
])
('nonce', bitcoin_data.StructType('<Q')),
('sub_version', bitcoin_data.VarStrType()),
('mode', bitcoin_data.StructType('<I')),
- ('best_share_hash', bitcoin_data.PossiblyNone(0, bitcoin_data.HashType())),
+ ('best_share_hash', bitcoin_data.PossiblyNoneType(0, bitcoin_data.HashType())),
])
def handle_version(self, version, services, addr_to, addr_from, nonce, sub_version, mode, best_share_hash):
self.other_version = version