示例#1
0
def get_pool_ledger(node_name):
    config = getConfig()
    config_helper = NodeConfigHelper(node_name, config)

    genesis_txn_initiator = GenesisTxnInitiatorFromFile(config_helper.genesis_dir,
                                                        config.poolTransactionsFile)
    hash_store = initHashStore(config_helper.ledger_dir, "pool", config)
    return Ledger(CompactMerkleTree(hashStore=hash_store),
                  dataDir=config_helper.ledger_dir,
                  fileName=config.poolTransactionsFile,
                  ensureDurability=config.EnsureLedgerDurability,
                  genesis_txn_initiator=genesis_txn_initiator)
示例#2
0
    def _create_ledger(self, name: str, genesis: Optional[GenesisTxnInitiator] = None) -> Ledger:
        hs_type = HS_MEMORY if self.data_location is None else None
        hash_store = initHashStore(self.data_location, name, self.config, hs_type=hs_type)
        txn_file_name = getattr(self.config, "{}TransactionsFile".format(name))

        txn_log_storage = None
        if self.data_location is None:
            txn_log_storage = KeyValueStorageInMemory()

        return Ledger(CompactMerkleTree(hashStore=hash_store),
                      dataDir=self.data_location,
                      fileName=txn_file_name,
                      transactionLogStore=txn_log_storage,
                      ensureDurability=self.config.EnsureLedgerDurability,
                      genesis_txn_initiator=genesis)
示例#3
0
 def hashStore(self):
     return initHashStore(self.ledgerLocation, 'pool', self.config)
示例#4
0
def get_token_hash_store(data_dir):
    return initHashStore(data_dir=data_dir, name='sovtoken')