diff --git a/core/src/wallet/bitcoin/BitcoinLikeAccount.cpp b/core/src/wallet/bitcoin/BitcoinLikeAccount.cpp index 7bd82cea3d..5058321838 100644 --- a/core/src/wallet/bitcoin/BitcoinLikeAccount.cpp +++ b/core/src/wallet/bitcoin/BitcoinLikeAccount.cpp @@ -115,22 +115,16 @@ namespace ledger { void BitcoinLikeAccount::interpretTransaction(const BitcoinLikeBlockchainExplorerTransaction& transaction, std::vector& out, bool needExtendKeychain) { auto nodeIndex = std::const_pointer_cast(_keychain)->getFullDerivationScheme().getPositionForLevel(DerivationSchemeLevel::NODE); - std::cout << "2" << std::endl; std::list> accountInputs; std::list> accountOutputs; - std::cout << "3" << std::endl; uint64_t fees = 0L; - std::cout << "4" << std::endl; uint64_t sentAmount = 0L; uint64_t receivedAmount = 0L; std::vector senders; senders.reserve(transaction.inputs.size()); - std::cout << "5" << std::endl; std::vector recipients; recipients.reserve(transaction.outputs.size()); - std::cout << "6 " << std::endl; int result = FLAG_TRANSACTION_IGNORED; - std::cout << "Find inputs" << std::endl; // Find inputs for (auto& input : transaction.inputs) { @@ -156,7 +150,6 @@ namespace ledger { fees += input.value.getValue().toUint64(); } } - std::cout << "Find outputs" << std::endl; // Find outputs auto hasSpentNothing = sentAmount == 0L; auto outputCount = transaction.outputs.size(); @@ -191,7 +184,6 @@ namespace ledger { } std::stringstream snds; strings::join(senders, snds, ","); - std::cout << "inflateOperation" << std::endl; Operation operation; inflateOperation(operation, transaction); operation.senders = std::move(senders); @@ -199,7 +191,6 @@ namespace ledger { operation.fees = std::move(BigInt().assignI64(fees)); operation.trust = std::make_shared(); operation.date = transaction.receivedAt; - std::cout << "compute trust" << std::endl; // Compute trust computeOperationTrust(operation, transaction); @@ -218,7 +209,6 @@ namespace ledger { operation.refreshUid(); out.push_back(operation); } - std::cout << "accountOutputs" << std::endl; if (accountOutputs.size() > 0) { // Receive BigInt amount; @@ -247,20 +237,13 @@ namespace ledger { } Try BitcoinLikeAccount::bulkInsert(const std::vector &ops) { - std::cout << "bulk insert method" << std::endl; return Try::from([&] () { - std::cout << "sql session" << std::endl; soci::session sql(getWallet()->getDatabase()->getPool()); - std::cout << "sql transaction" << std::endl; soci::transaction tr(sql); - std::cout << "BitcoinLikeOperationDatabaseHelper::bulkInsert" << std::endl; BitcoinLikeOperationDatabaseHelper::bulkInsert(sql, ops); - std::cout << "tr.commit" << std::endl; tr.commit(); - std::cout << "emitNewOperationsEvent" << std::endl; // Emit emitNewOperationsEvent(ops); - std::cout << "emitNewOperationsEvent finish" << std::endl; return ops.size(); }); } @@ -615,12 +598,10 @@ namespace ledger { const std::shared_ptr &callback) { auto self = getSelf(); _explorer->pushTransaction(transaction).map(getContext(), [self, transaction] (const String& seq) -> std::string { - std::cout<<"transaction send request finish"<logger()->warn("transaction send request finish"); //Store newly broadcasted tx in db //First parse it auto txHash = seq.str(); - std::cout << "got tx hash" << std::endl; self->logger()->warn("got tx hash"); auto optimisticUpdate = Try::from([&] () -> Unit { //Get last block from DB or cache @@ -632,7 +613,6 @@ namespace ledger { } else { lastBlockHeight = getLastBlockFromDB(sql, self->getWallet()->getCurrency().name); } - std::cout << "parseRawSignedTransaction" << std::endl; self->logger()->warn(" parseRawSignedTransaction"); auto tx = BitcoinLikeTransactionApi::parseRawSignedTransaction(self->getWallet()->getCurrency(), transaction, lastBlockHeight); @@ -643,7 +623,6 @@ namespace ledger { txExplorer.receivedAt = std::chrono::system_clock::now(); txExplorer.version = tx->getVersion(); txExplorer.confirmations = 0; - std::cout << "input" << std::endl; self->logger()->warn(" input"); //Inputs auto inputCount = tx->getInputs().size(); @@ -665,7 +644,6 @@ namespace ledger { in.address = prevTx.outputs[prevTxOutputIndex].address.getValueOr(""); txExplorer.inputs.push_back(in); } - std::cout << "output" << std::endl; self->logger()->warn(" output"); //Outputs auto keychain = self->getKeychain(); @@ -681,18 +659,13 @@ namespace ledger { out.address = output->getAddress().value_or(""); txExplorer.outputs.push_back(out); } - std::cout << "save db" << std::endl; self->logger()->warn(" save db"); //Store in DB std::vector operations; - std::cout << "operations" << std::endl; self->interpretTransaction(txExplorer, operations); - std::cout << "interpretTransaction finish" << std::endl; self->bulkInsert(operations); - std::cout << "bulkInsert finish" << std::endl; self->emitEventsNow(); - std::cout << "saved db" << std::endl; self->logger()->warn(" saved db"); return unit; @@ -702,12 +675,10 @@ namespace ledger { // because the tx was successfully broadcasted to the network, // and the update will occur at next synchro ... // But still let's log that ! - std::cout << "optimisticUpdate" << std::endl; self->logger()->warn(" optimisticUpdate"); if (optimisticUpdate.isFailure()) { self->logger()->warn(" Optimistic update failed for broadcasted transaction : {}", txHash); } - std::cout << "optimisticUpdate finish" << std::endl; self->logger()->warn(" optimisticUpdate finish"); return txHash; }).callback(getMainExecutionContext(), callback); diff --git a/core/src/wallet/common/AbstractAccount.cpp b/core/src/wallet/common/AbstractAccount.cpp index f0eb05ae9a..1a02f34f00 100644 --- a/core/src/wallet/common/AbstractAccount.cpp +++ b/core/src/wallet/common/AbstractAccount.cpp @@ -231,23 +231,18 @@ namespace ledger { void AbstractAccount::emitEventsNow() { auto self = shared_from_this(); - std::cout << "emitEventsNow method" << std::endl; run([self] () { - std::cout << "run" << std::endl; std::list> events; std::shared_ptr batchedOperationsEvent; std::shared_ptr batchedBlocksEvent; { - std::cout << "batchedOperationsEvent" << std::endl; std::lock_guard lock(self->_eventsLock); std::swap(events, self->_events); batchedOperationsEvent = self->_batchedOperationsEvent; self->_batchedOperationsEvent = nullptr; } - std::cout << "publisher post" << std::endl; if (batchedOperationsEvent) self->_publisher->post(batchedOperationsEvent); - std::cout << "post event" << std::endl; for (auto& event : events) { self->_publisher->post(event); }