| 52 | } |
| 53 | |
| 54 | void BlockChain::start() |
| 55 | { |
| 56 | startFuture = chainThread->async([this] { |
| 57 | try { |
| 58 | QSettings settings; |
| 59 | rpcEndpoint = settings.value( "rpc-endpoint", "127.0.0.1:8091" ).value<QString>(); |
| 60 | grapheneApp->register_plugin<graphene::account_history::account_history_plugin>(); |
| 61 | grapheneApp->register_plugin<graphene::market_history::market_history_plugin>(); |
| 62 | |
| 63 | QString dataDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); |
| 64 | QDir(dataDir).mkpath("."); |
| 65 | idump((dataDir.toStdString())); |
| 66 | boost::program_options::variables_map map; |
| 67 | map.insert({"rpc-endpoint",boost::program_options::variable_value(rpcEndpoint.toStdString(), false)}); |
| 68 | grapheneApp->initialize(dataDir.toStdString(), map); |
| 69 | grapheneApp->initialize_plugins(map); |
| 70 | grapheneApp->startup(); |
| 71 | grapheneApp->startup_plugins(); |
| 72 | |
| 73 | graphene::app::api_access_info webPermissions; |
| 74 | auto passHash = fc::sha256::hash(webPassword.toStdString()); |
| 75 | webPermissions.password_hash_b64 = fc::base64_encode(passHash.data(), passHash.data_size()); |
| 76 | webPermissions.password_salt_b64 = fc::base64_encode(""); |
| 77 | webPermissions.allowed_apis = {"database_api", "network_broadcast_api", "network_node_api", "history_api"}; |
| 78 | grapheneApp->set_api_access_info(webUsername.toStdString(), std::move(webPermissions) ); |
| 79 | } catch (const fc::exception& e) { |
| 80 | elog("Crap went wrong: ${e}", ("e", e.to_detail_string())); |
| 81 | } |
| 82 | QMetaObject::invokeMethod(this, "started"); |
| 83 | }); |
| 84 | } |
no test coverage detected