X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Fmain.cpp;h=d92f528b74bf73d2d64ab542359595236b9f882b;hp=c27b8c2041ff09f627ce072ae94aae899a0aea53;hb=67d038bcf2a329ea1304aede5997a5bc3d2c8062;hpb=0ef485c34dd98febcab3cfc237dc7e9f42128792 diff --git a/src/main.cpp b/src/main.cpp index c27b8c2..d92f528 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -679,11 +679,6 @@ bool CTxMemPool::remove(CTransaction &tx) return true; } - - - - - int CMerkleTx::GetDepthInMainChain(CBlockIndex* &pindexRet) const { if (hashBlock == 0 || nIndex == -1) @@ -738,8 +733,6 @@ bool CMerkleTx::AcceptToMemoryPool() return AcceptToMemoryPool(txdb); } - - bool CWalletTx::AcceptWalletTransaction(CTxDB& txdb, bool fCheckInputs) { @@ -782,14 +775,31 @@ int CTxIndex::GetDepthInMainChain() const return 1 + nBestHeight - pindex->nHeight; } - - - - - - - - +// Return transaction in tx, and if it was found inside a block, its hash is placed in hashBlock +bool GetTransaction(const uint256 &hash, CTransaction &tx, uint256 &hashBlock) +{ + { + LOCK(cs_main); + { + LOCK(mempool.cs); + if (mempool.exists(hash)) + { + tx = mempool.lookup(hash); + return true; + } + } + CTxDB txdb("r"); + CTxIndex txindex; + if (tx.ReadFromDisk(txdb, COutPoint(hash, 0), txindex)) + { + CBlock block; + if (block.ReadFromDisk(txindex.pos.nFile, txindex.pos.nBlockPos, false)) + hashBlock = block.GetHash(); + return true; + } + } + return false; +} ////////////////////////////////////////////////////////////////////////////// //