コード例 #1
0
def create_default_shard_state(env, shard_id=0, diff_calc=None):
    genesis_manager = GenesisManager(env.quark_chain_config)
    shard_size = next(iter(env.quark_chain_config.shards.values())).SHARD_SIZE
    full_shard_id = shard_size | shard_id
    shard_state = ShardState(env=env,
                             full_shard_id=full_shard_id,
                             diff_calc=diff_calc)
    shard_state.init_genesis_state(genesis_manager.create_root_block())
    return shard_state
コード例 #2
0
def create_default_shard_state(env,
                               shard_id=0,
                               diff_calc=None,
                               posw_override=False,
                               no_coinbase=False):
    genesis_manager = GenesisManager(env.quark_chain_config)
    shard_size = next(iter(env.quark_chain_config.shards.values())).SHARD_SIZE
    full_shard_id = shard_size | shard_id
    if posw_override:
        posw_config = env.quark_chain_config.shards[full_shard_id].POSW_CONFIG
        posw_config.ENABLED = True
    if no_coinbase:
        env.quark_chain_config.shards[full_shard_id].COINBASE_AMOUNT = 0
    shard_state = ShardState(env=env,
                             full_shard_id=full_shard_id,
                             diff_calc=diff_calc)
    shard_state.init_genesis_state(genesis_manager.create_root_block())
    return shard_state
コード例 #3
0
 def __create_genesis_block(self):
     genesis_manager = GenesisManager(self.env.quark_chain_config)
     genesis_block = genesis_manager.create_root_block()
     self.db.put_root_block(genesis_block, [])
     self.db.put_root_block_index(genesis_block)
     self.tip = genesis_block.header
コード例 #4
0
def create_default_shard_state(env, shard_id=0, diff_calc=None):
    genesis_manager = GenesisManager(env.quark_chain_config)
    shard_state = ShardState(env=env, shard_id=shard_id, diff_calc=diff_calc)
    shard_state.init_genesis_state(genesis_manager.create_root_block())
    return shard_state