diff --git a/src/wallet/MoneroWallet.cpp b/src/wallet/MoneroWallet.cpp index 2182a66..5ffa2ec 100644 --- a/src/wallet/MoneroWallet.cpp +++ b/src/wallet/MoneroWallet.cpp @@ -84,8 +84,12 @@ namespace monero { * @param skipIfAbsent specifies if the tx should not be added if it doesn't already exist */ void mergeTx(const shared_ptr& tx, map>& txMap, map>& blockMap, bool skipIfAbsent) { + cout << "MoneroWallet::mergeTx()" << endl; if (tx->id == boost::none) throw runtime_error("Tx id is not initialized"); +// txMap[*tx->id] = tx; +// if (true) return; + // if tx doesn't exist, add it (unless skipped) map>::const_iterator txIter = txMap.find(*tx->id); if (txIter == txMap.end()) { @@ -100,21 +104,21 @@ namespace monero { else { // get existing tx to merge with - shared_ptr aTx = txMap[*tx->id]; + shared_ptr& aTx = txMap[*tx->id]; // merge blocks if confirmed, txs otherwise if (aTx->block != boost::none || tx->block != boost::none) { if (aTx->block == boost::none) { aTx->block = shared_ptr(new MoneroBlock()); - (*aTx->block)->txs.push_back(tx); - (*aTx->block)->height = *tx->getHeight(); + aTx->block.get()->txs.push_back(tx); + aTx->block.get()->height = tx->getHeight(); } if (tx->block == boost::none) { tx->block = shared_ptr(new MoneroBlock()); - (*tx->block)->txs.push_back(tx); - (*tx->block)->height = *aTx->getHeight(); + tx->block.get()->txs.push_back(tx); + tx->block.get()->height = aTx->getHeight(); } - (*aTx->block)->merge(*aTx->block, *tx->block); + aTx->block.get()->merge(aTx->block.get(), tx->block.get()); } else { aTx->merge(aTx, tx); } @@ -122,12 +126,12 @@ namespace monero { // if confirmed, merge tx's block if (tx->getHeight() != boost::none) { - map>::const_iterator blockIter = blockMap.find(*tx->getHeight()); + map>::const_iterator blockIter = blockMap.find(tx->getHeight().get()); if (blockIter == blockMap.end()) { - blockMap[*tx->getHeight()] = *tx->block; + blockMap[tx->getHeight().get()] = tx->block.get(); } else { - shared_ptr aBlock = blockMap[*tx->getHeight()]; - aBlock->merge(aBlock, *tx->block); + shared_ptr& aBlock = blockMap[tx->getHeight().get()]; + aBlock->merge(aBlock, tx->block.get()); } } } @@ -883,7 +887,7 @@ namespace monero { } shared_ptr MoneroWallet::buildTxWithVout(const tools::wallet2::transfer_details& td) const { - cout << "MoneroWallet::bulidTxWithVout()" << endl; + cout << "MoneroWallet::buildWithVout()" << endl; // construct block shared_ptr block = shared_ptr(new MoneroBlock());