def write(self, file, item):
return self._inner_size.write(file, len(item)), item
-class FixedStrType(Type):
- def __init__(self, length):
- self.length = length
-
- def read(self, file):
- return read(file, self.length)
-
- def write(self, file, item):
- if len(item) != self.length:
- raise ValueError('incorrect length item!')
- return file, item
-
class PassthruType(Type):
def read(self, file):
return read(file, size(file))
('last', bitcoin_data.PossiblyNoneType(0, bitcoin_data.HashType())),
])
message_getaddr = bitcoin_data.ComposedType([])
- message_checkorder = bitcoin_data.ComposedType([
- ('id', bitcoin_data.HashType()),
- ('order', bitcoin_data.FixedStrType(60)), # XXX
- ])
- message_submitorder = bitcoin_data.ComposedType([
- ('id', bitcoin_data.HashType()),
- ('order', bitcoin_data.FixedStrType(60)), # XXX
- ])
message_addr = bitcoin_data.ComposedType([
('addrs', bitcoin_data.ListType(bitcoin_data.ComposedType([