@@ -872,31 +872,45 @@ def get_settings(self, args: Namespace) -> dict:
872872 if args .no_ledger :
873873 settings ["ledger.disabled" ] = True
874874 else :
875- configured = False
875+ single_configured = False
876+ multi_configured = False
876877 if args .genesis_url :
877878 settings ["ledger.genesis_url" ] = args .genesis_url
878- configured = True
879+ single_configured = True
879880 elif args .genesis_file :
880881 settings ["ledger.genesis_file" ] = args .genesis_file
881- configured = True
882+ single_configured = True
882883 elif args .genesis_transactions :
883884 settings ["ledger.genesis_transactions" ] = args .genesis_transactions
884- configured = True
885+ single_configured = True
885886 if args .genesis_transactions_list :
886887 with open (args .genesis_transactions_list , "r" ) as stream :
887888 txn_config_list = yaml .safe_load (stream )
888889 ledger_config_list = []
889890 for txn_config in txn_config_list :
890891 ledger_config_list .append (txn_config )
892+ if "is_write" in txn_config and txn_config ["is_write" ]:
893+ if "genesis_url" in txn_config :
894+ settings ["ledger.genesis_url" ] = txn_config ["genesis_url" ]
895+ elif "genesis_file" in txn_config :
896+ settings ["ledger.genesis_file" ] = txn_config ["genesis_file" ]
897+ elif "genesis_transactions" in txn_config :
898+ settings ["ledger.genesis_transactions" ] = txn_config ["genesis_transactions" ]
899+ else :
900+ raise ArgsParseError ("No genesis information provided for write ledger" )
891901 settings ["ledger.ledger_config_list" ] = ledger_config_list
892- configured = True
893- if not configured :
902+ multi_configured = True
903+ if not ( single_configured or multi_configured ) :
894904 raise ArgsParseError (
895905 "One of --genesis-url --genesis-file, --genesis-transactions "
896906 "or --genesis-transactions-list must be specified (unless "
897907 "--no-ledger is specified to explicitly configure aca-py to"
898908 " run with no ledger)."
899909 )
910+ if single_configured and multi_configured :
911+ raise ArgsParseError (
912+ "Cannot configure both single- and multi-ledger."
913+ )
900914 if args .ledger_pool_name :
901915 settings ["ledger.pool_name" ] = args .ledger_pool_name
902916 if args .ledger_keepalive :
0 commit comments