コード例 #1
0
ファイル: processblock.py プロジェクト: yourhrh/Request
 def to_dict(self):
     return {
         "bloom": encode_hex(bloom.b64(bloom.bloom_from_list(self.bloomables()))),
         "address": encode_hex(self.address),
         "data": b"0x" + encode_hex(self.data),
         "topics": [encode_hex(utils.int32.serialize(t)) for t in self.topics],
     }
コード例 #2
0
 def to_dict(self):
     return {
         "bloom": encode_hex(bloom.b64(bloom.bloom_from_list(self.bloomables()))),
         "address": encode_hex(self.address),
         "data": b'0x' + encode_hex(self.data),
         "topics": [encode_hex(utils.int32.serialize(t))
                    for t in self.topics]
     }
コード例 #3
0
ファイル: test_bloom.py プロジェクト: wub11/pyetherum
def do_test_bloom(test_logs):
    """
    The logs sections is a mapping between the blooms and their corresponding logentries.
    Each logentry has the format:
    address: The address of the logentry.
    data: The data of the logentry.
    topics: The topics of the logentry, given as an array of values.
    """
    for data in test_logs:
        address = data['address']
        # Test via bloom
        b = bloom.bloom_insert(0, decode_hex(address))
        for t in data['topics']:
            b = bloom.bloom_insert(b, decode_hex(t))
        # Test via Log
        topics = [decode_int_from_hex(x) for x in data['topics']]
        log = Log(decode_hex(address), topics, '')
        log_bloom = bloom.b64(bloom.bloom_from_list(log.bloomables()))
        assert encode_hex(log_bloom) == encode_hex_from_int(b)
        assert data['bloom'] == encode_hex(log_bloom)
コード例 #4
0
ファイル: test_bloom.py プロジェクト: akosba/pyethereum
def do_test_bloom(test_logs):
    """
    The logs sections is a mapping between the blooms and their corresponding logentries.
    Each logentry has the format:
    address: The address of the logentry.
    data: The data of the logentry.
    topics: The topics of the logentry, given as an array of values.
    """
    for data in test_logs:
        address = data["address"]
        # Test via bloom
        b = bloom.bloom_insert(0, decode_hex(address))
        for t in data["topics"]:
            b = bloom.bloom_insert(b, decode_hex(t))
        # Test via Log
        topics = [decode_int_from_hex(x) for x in data["topics"]]
        log = pb.Log(decode_hex(address), topics, "")
        log_bloom = bloom.b64(bloom.bloom_from_list(log.bloomables()))
        assert encode_hex(log_bloom) == encode_hex_from_int(b)
        assert str_to_bytes(data["bloom"]) == encode_hex(log_bloom)
コード例 #5
0
 def log_bloom_b64(self):
     return bloom.b64(self.log_bloom())
コード例 #6
0
ファイル: transactions.py プロジェクト: 4gn3s/pyethereum
 def log_bloom_b64(self):
     return bloom.b64(self.log_bloom())