Пример #1
0
    def process_block(self, block):
        print('{}: new block received {} ({})'.format(self.network.type, block.number, block.hash), flush=True)
        if not block.transactions:
            print('{}: no transactions in {} ({})'.format(self.network.type, block.number, block.hash), flush=True)
            return

        address_transactions = defaultdict(list)
        for transaction in block.transactions:
            for output in transaction.outputs:
                for a in output.address:
                    address_transactions[a].append(transaction)

        # print('{}: transactions'.format(self.network.type), address_transactions, flush=True)
        block_event = BlockEvent(self.network, block, address_transactions)

        pub.sendMessage(self.network.type, block_event=block_event)
    def process_block(self, block: WrapperBlock):
        print('{}: new block received {} ({})'.format(self.network.type,
                                                      block.number,
                                                      block.hash),
              flush=True)

        if not block.transactions:
            print('{}: no transactions in {} ({})'.format(
                self.network.type, block.number, block.hash),
                  flush=True)
            return

        address_transactions = collections.defaultdict(list)
        for transaction in block.transactions:
            #self._check_tx_from(transaction, address_transactions)
            self._check_tx_to(transaction, address_transactions)
        block_event = BlockEvent(self.network, block, address_transactions)
        pub.sendMessage(self.network.type, block_event=block_event)
Пример #3
0
 def process_block(self, block: WrapperBlock):
     address_transactions = collections.defaultdict(list)
     for transaction in block.transactions:
         self._check_tx_to(transaction, address_transactions)
     block_event = BlockEvent(self.network, block, address_transactions)
     pub.sendMessage(self.network.type, block_event=block_event)