Dependency(const Dependency& obj) { m_name=nullptr; if(obj.m_name==nullptr) { r_target=obj.r_target; } else { nameSet(obj.m_name); r_target=nullptr; } m_rel=obj.m_rel; }
Status Wallet::createNew(const std::string &name, int currency) { // Set up the keys: ABC_CHECK(randomData(bitcoinKey_, BITCOIN_SEED_LENGTH)); bitcoinKeyBackup_ = bitcoinKey_; ABC_CHECK(randomData(dataKey_, DATA_KEY_LENGTH)); DataChunk syncKey; ABC_CHECK(randomData(syncKey, SYNC_KEY_LENGTH)); syncKey_ = base16Encode(syncKey); // Create the sync directory: ABC_CHECK(fileEnsureDir(gContext->paths.walletsDir())); ABC_CHECK(fileEnsureDir(dir())); ABC_CHECK(fileEnsureDir(syncDir())); ABC_CHECK(syncMakeRepo(syncDir())); // Populate the sync directory: ABC_CHECK(currencySet(currency)); ABC_CHECK(nameSet(name)); ABC_CHECK(addresses.load()); // Push the wallet to the server: bool dirty = false; ABC_CHECK(loginServerWalletCreate(account.login, syncKey_)); ABC_CHECK(syncRepo(syncDir(), syncKey_, dirty)); ABC_CHECK(loginServerWalletActivate(account.login, syncKey_)); // If everything worked, add the wallet to the account: WalletJson json; ABC_CHECK(json.bitcoinKeySet(base16Encode(bitcoinKey_))); ABC_CHECK(json.dataKeySet(base16Encode(dataKey_))); ABC_CHECK(json.syncKeySet(syncKey_)); ABC_CHECK(account.wallets.insert(id_, json)); ABC_CHECK(account.sync(dirty)); return Status(); }