|
1 | 1 | import rlp
|
2 | 2 | from ethereum.block import BlockHeader, Block
|
3 | 3 | from ethereum.utils import is_numeric, is_string, encode_hex, decode_hex, zpad, scan_bin, big_endian_to_int
|
4 |
| -from ethereum import state_transition |
| 4 | +from ethereum import common |
| 5 | +from ethereum.pow import consensus |
5 | 6 | from ethereum.state import State, Account
|
6 | 7 | from ethereum.securetrie import SecureTrie
|
7 | 8 | from ethereum.trie import BLANK_NODE, BLANK_ROOT
|
8 |
| -from ethereum.pruning_trie import Trie |
| 9 | +from ethereum.experimental.pruning_trie import Trie |
9 | 10 |
|
10 | 11 |
|
11 | 12 | class FakeHeader(object):
|
@@ -112,27 +113,27 @@ def load_snapshot(chain, snapshot):
|
112 | 113 | chain.env.db.commit()
|
113 | 114 |
|
114 | 115 | print "Start loading recent blocks from snapshot"
|
115 |
| - vbh = state_transition.validate_block_header |
116 |
| - vus = state_transition.validate_uncles |
| 116 | + vbh = common.validate_header |
| 117 | + vus = consensus.validate_uncles |
117 | 118 | def _vbh(state, header):
|
118 | 119 | return True
|
119 | 120 | def _vus(state, block):
|
120 | 121 | return True
|
121 |
| - state_transition.validate_block_header = _vbh |
122 |
| - state_transition.validate_uncles = _vus |
| 122 | + common.validate_header = _vbh |
| 123 | + consensus.validate_uncles = _vus |
123 | 124 | # add the first block
|
124 | 125 | first_block = rlp.decode(first_block_rlp, sedes=Block)
|
125 | 126 | chain.head_hash = first_block.header.prevhash
|
126 | 127 | chain.add_block(first_block)
|
127 | 128 | assert chain.head_hash == first_block.header.hash
|
128 |
| - state_transition.validate_block_header = vbh |
| 129 | + common.validate_header = vbh |
129 | 130 |
|
130 | 131 | count = 0
|
131 | 132 | for block_rlp in snapshot['blocks'][1:]:
|
132 | 133 | block_rlp = scan_bin(block_rlp)
|
133 | 134 | block = rlp.decode(block_rlp, Block)
|
134 | 135 | if count == chain.state.config['MAX_UNCLE_DEPTH']+2:
|
135 |
| - state_transition.validate_uncles = vus |
| 136 | + consensus.validate_uncles = vus |
136 | 137 | if not chain.add_block(block):
|
137 | 138 | print "Failed to load block #%d (%s), abort." % (block.number, encode_hex(block.hash)[:8])
|
138 | 139 | else:
|
|
0 commit comments