bool Wallet::generateKeyPair() { // FIXME: initialize OpenSSL elsewhere soon initialize(); qCInfo(commerce) << "Generating keypair."; auto keyPair = generateECKeypair(); if (!keyPair.first) { qCWarning(commerce) << "Empty keypair"; return false; } writeBackupInstructions(); // TODO: redo this soon -- need error checking and so on writeSecurityImage(_securityImage, keyFilePath()); QString key = keyPair.first->toBase64(); _publicKeys.push_back(key); qCDebug(commerce) << "public key:" << key; _isOverridingServer = false; // It's arguable whether we want to change the receiveAt every time, but: // 1. It's certainly needed the first time, when createIfNeeded answers true. // 2. It is maximally private, and we can step back from that later if desired. // 3. It maximally exercises all the machinery, so we are most likely to surface issues now. auto ledger = DependencyManager::get<Ledger>(); return ledger->receiveAt(key, key, getWallet()); }
//play Craps game, calling all appropriate functions //Parameter: none //Return Type: none void playCraps(void) { int wallet; int bet; wallet = getWallet(); do { bet = makeBet(wallet); if (playRound()) //this just means if it's true { printf("You win!\n"); wallet += bet; } else //if playRound is false { printf("You lose!\n"); wallet -= bet; } } while (wallet >= MIN_BET&&doAgain()); goodbye(wallet); }