Exemple #1
0
    def verify(self, transaction):
        try:
            decoded = DecodedTransaction.from_transaction(transaction, self.ABI)
        except ValueError as e:
            logger.error('Transaction verification failed: %s', str(e))
            return False

        logger.debug('Expected: %s, Actual: %s', self, decoded)
        bounty_guid, votes, valid_bloom = decoded.parameters

        return decoded.value == 0 and \
            guid_as_string(bounty_guid) == self.bounty_guid and \
            int_to_bool_list(votes, len(self.votes)) == self.votes and \
            valid_bloom == self.valid_bloom
Exemple #2
0
    def verify(self, transaction):
        try:
            decoded = DecodedTransaction.from_transaction(transaction, self.ABI)
        except ValueError as e:
            logger.error('Transaction verification failed: %s', str(e))
            return False

        logger.debug('Expected: %s, Actual: %s', self, decoded)
        bounty_guid, bid, mask, commitment = decoded.parameters

        return decoded.value == 0 and \
            guid_as_string(bounty_guid) == self.bounty_guid and \
            bid == self.bid and \
            commitment == self.commitment and \
            int_to_bool_list(mask, len(self.mask)) == self.mask
    def verify(self, transaction):
        try:
            decoded = DecodedTransaction.from_transaction(
                transaction, self.ABI)
        except ValueError as e:
            logger.error('Transaction verification failed: %s', str(e))
            return False

        logger.debug('Expected: %s, Actual: %s', self, decoded)
        bounty_guid, index, nonce, verdicts, metadata = decoded.parameters

        # If there is a 1 anywhere beyond the length of items we expect, fail it
        if verdicts >> len(self.verdicts) > 0:
            return False

        return decoded.value == 0 and \
            guid_as_string(bounty_guid) == self.bounty_guid and \
            index == self.index and \
            nonce == self.nonce and \
            int_to_bool_list(verdicts, len(self.verdicts)) == self.verdicts and \
            metadata == self.metadata