Ejemplo n.º 1
0
    def test_invalid_name(self):
        created = signal.create(self.btctxstore, self.wif, "test")

        # repack to eliminate namedtuples and simulate io
        repacked = umsgpack.unpackb(umsgpack.packb(created))

        self.assertIsNone(signal.read(self.btctxstore, repacked, "wrongname"))
Ejemplo n.º 2
0
    def test_invalid_token(self):
        created = base.create(self.btctxstore, self.wif, None, None)

        # repack to eliminate namedtuples and simulate io
        repacked = umsgpack.unpackb(umsgpack.packb(created))
        repacked[2] = "invalidtoken"

        self.assertIsNone(signal.read(self.btctxstore, self.nodeid, repacked))
Ejemplo n.º 3
0
    def test_create_read(self):

        # test create
        created = signal.create(self.btctxstore, self.wif, "test")

        # repack to eliminate namedtuples and simulate io
        repacked = umsgpack.unpackb(umsgpack.packb(created))

        # test read
        read = signal.read(self.btctxstore, repacked, "test")
        self.assertIsNotNone(read)
        self.assertEqual(created, read)
Ejemplo n.º 4
0
 def __call__(self, node, source_id, msg):
     request = signal.read(node.server.btctxstore, msg, "request_info")
     if request is not None:
         _respond(node, request.sender, self.store_config)
Ejemplo n.º 5
0
 def handler(node, source_id, msg):
     request = signal.read(node.server.btctxstore, msg, "request_peers")
     if request is not None:
         peers = list(map(lambda n: n.id, node.get_neighbours()))
         msg = create(node.server.btctxstore, node.get_key(), peers)
         node.relay_message(request.sender, msg)