Пример #1
0
  
  # Autodetect available workers if requested or if a new instance is being set up
  if options.detect_workers or core.is_new_instance:
    core.detect_workers()

  # Add example work sources if requested or if a new instance is being set up
  if options.add_example_work_sources or core.is_new_instance:
    from core.blockchain import Blockchain
    from core.worksourcegroup import WorkSourceGroup
    from modules.theseven.bcjsonrpc.bcjsonrpcworksource import BCJSONRPCWorkSource
    # Find the Bitcoin block chain, or create it if neccessary
    blockchain = core.get_blockchain_by_name("Bitcoin")
    if not blockchain:
      blockchain = Blockchain(core)
      blockchain.settings.name = "Bitcoin"
      core.add_blockchain(blockchain)
    # Save the old root work source (will be moved around)
    usersources = core.get_root_work_source()
    # Create the new root work source group
    newroot = WorkSourceGroup(core)
    # Copy the old root work source's name to the new one
    newroot.settings.name = usersources.settings.name
    # Reconfigure the old root work source
    usersources.settings.name = "User work sources"
    usersources.settings.priority = 1000
    usersources.apply_settings()
    newroot.add_work_source(usersources)
    # Create example work source group
    examplesources = WorkSourceGroup(core)
    examplesources.settings.name = "Example/donation work sources"
    examplesources.settings.priority = 10
  # Autodetect available workers if requested or if a new instance is being set up
  if options.detect_workers or core.is_new_instance:
    core.detect_workers()

  # Add example work sources if requested or if a new instance is being set up
  if options.add_example_work_sources or core.is_new_instance:
    from core.blockchain import Blockchain
    from core.worksourcegroup import WorkSourceGroup
    from modules.theseven.bcjsonrpc.bcjsonrpcworksource import BCJSONRPCWorkSource
    # Find the Bitcoin block chain, or create it if neccessary
    blockchain = core.get_blockchain_by_name("Bitcoin")
    if not blockchain:
      blockchain = Blockchain(core)
      blockchain.settings.name = "Bitcoin"
      core.add_blockchain(blockchain)
    # Save the old root work source (will be moved around)
    usersources = core.get_root_work_source()
    # Create the new root work source group
    newroot = WorkSourceGroup(core)
    # Copy the old root work source's name to the new one
    newroot.settings.name = usersources.settings.name
    # Reconfigure the old root work source
    usersources.settings.name = "User work sources"
    usersources.settings.priority = 1000
    usersources.apply_settings()
    newroot.add_work_source(usersources)
    # Create example work source group
    examplesources = WorkSourceGroup(core)
    examplesources.settings.name = "Example/donation work sources"
    examplesources.settings.priority = 10