Esempio n. 1
0
 def __init__(self, block_data, newblock_timestamp=0):
     self.newblock_timestamp = newblock_timestamp
     self.header = BlockHeader.deserialize(block_data[0])
     self.transaction_list = rlp.sedes.CountableList(
         Transaction).deserialize(block_data[1])
     self.uncles = rlp.sedes.CountableList(BlockHeader).deserialize(
         block_data[2])
Esempio n. 2
0
def test_export():
    # requires a chain with at least 5 blocks
    assert subprocess.call('pyethapp export', shell=True) != 0
    assert subprocess.call('pyethapp export --from -1 -', shell=True) != 0
    assert subprocess.call('pyethapp export --to -3 -', shell=True) != 0
    assert subprocess.call('pyethapp export --from 4 --to 2 -', shell=True) != 0

    result = subprocess.Popen('pyethapp export --from 2 --to 4 -', shell=True,
                              stdout=subprocess.PIPE)
    result.wait()
    assert result.returncode == 0
    s = result.stdout.read()

    headers = []
    end = 0
    while end < len(s):
        item, end = rlp.codec.consume_item(s, end)
        headers.append(BlockHeader.deserialize(item[0]))
    assert [header.number for header in headers] == [2, 3, 4]
Esempio n. 3
0
def test_export():
    # requires a chain with at least 5 blocks
    assert subprocess.call('pyethapp export', shell=True) != 0
    assert subprocess.call('pyethapp export --from -1 -', shell=True) != 0
    assert subprocess.call('pyethapp export --to -3 -', shell=True) != 0
    assert subprocess.call('pyethapp export --from 4 --to 2 -',
                           shell=True) != 0

    result = subprocess.Popen('pyethapp export --from 2 --to 4 -',
                              shell=True,
                              stdout=subprocess.PIPE)
    result.wait()
    assert result.returncode == 0
    s = result.stdout.read()

    headers = []
    end = 0
    while end < len(s):
        item, end = rlp.codec.consume_item(s, end)
        headers.append(BlockHeader.deserialize(item[0]))
    assert [header.number for header in headers] == [2, 3, 4]
Esempio n. 4
0
 def __init__(self, block_data):
     self.header = BlockHeader.deserialize(block_data[0])
     self.transaction_list = block_data[1]
     self.uncles = block_data[2]
Esempio n. 5
0
 def __init__(self, block_data, newblock_timestamp=0):
     self.newblock_timestamp = newblock_timestamp
     self.header = BlockHeader.deserialize(block_data[0])
     self.transaction_list = rlp.sedes.CountableList(Transaction).deserialize(block_data[1])
     self.uncles = rlp.sedes.CountableList(BlockHeader).deserialize(block_data[2])