Skip to content

Commit

Permalink
fix(indy-validator): fixing indy validator initialization
Browse files Browse the repository at this point in the history
Signed-off-by: Izuru Sato <sato.izuru@fujitsu.com>
  • Loading branch information
izuru0 authored and takeutak committed Aug 30, 2021
1 parent cc39408 commit d9f6d5d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-----BEGIN EC PARAMETERS-----
BggqhkjOPQMBBw==
-----END EC PARAMETERS-----
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEICIlCfK3zMTFzUgdaj01LAHjJmHlbg6Xql9+i70iPz5EoAoGCCqGSM49
AwEHoUQDQgAEM+lIPbDTOuokqtoYPVvkmrawO5pxOFJSqLt+/PyjKta24oONnXnM
hpI61qTpdHEWH1X0aiR2DkY1tb+lNlxO6g==
-----END EC PRIVATE KEY-----
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

# from indy import ledger, pool
from indy import pool
from indy.error import ErrorCode, IndyError
from .utils import get_pool_genesis_txn_path, PROTOCOL_VERSION


from .Settings import Settings
from .IndyConnector import IndyConnector
Expand Down Expand Up @@ -122,9 +125,30 @@ def sign(self, data):
def init_indy(self):
""" Initialization process for INDY """
print(f'##called init_indy()')

self.run_coroutine(self.init_indy_pool)
self.run_coroutine(self.open_pool)
time.sleep(1)

# for INDY
async def init_indy_pool(self):
pool_ = {
'name': 'pool1'
}
print("Open Pool Ledger: {}".format(pool_['name']))
pool_['genesis_txn_path'] = get_pool_genesis_txn_path(pool_['name'])
pool_['config'] = json.dumps({"genesis_txn": str(pool_['genesis_txn_path'])})

# Set protocol version 2 to work with Indy Node 1.4
await pool.set_protocol_version(PROTOCOL_VERSION)

try:
await pool.create_pool_ledger_config(pool_['name'], pool_['config'])
print('##init_indy_pool create pool ledger config completed')
except IndyError as ex:
if ex.error_code == ErrorCode.PoolLedgerConfigAlreadyExistsError:
pass

# for INDY
async def open_pool(self):
# open the pool and get handler
Expand Down

0 comments on commit d9f6d5d

Please sign in to comment.