aboutsummaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2014-02-14 14:40:32 -0500
committerGavin Andresen <gavinandresen@gmail.com>2014-02-14 14:40:32 -0500
commit05d3ded072d782036c31c1d773c0441b87de843e (patch)
tree1dcdec2f37f61415aa5d1b71da101e0cfbd035fd /src/main.h
parente051e65c219cc72a2bba768f3d5e043ad055b48e (diff)
parent9a3d936fc2e98b1e8234bf27e09cf7bc22811bee (diff)
Merge pull request #3669 from gavinandresen/dead_txns
Handle "conflicted" transactions properly
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main.h b/src/main.h
index 05210e5164..09250e4a3e 100644
--- a/src/main.h
+++ b/src/main.h
@@ -423,6 +423,8 @@ public:
/** A transaction with a merkle branch linking it to the block chain. */
class CMerkleTx : public CTransaction
{
+private:
+ int GetDepthInMainChainINTERNAL(CBlockIndex* &pindexRet) const;
public:
uint256 hashBlock;
std::vector<uint256> vMerkleBranch;
@@ -461,9 +463,14 @@ public:
int SetMerkleBranch(const CBlock* pblock=NULL);
+
+ // Return depth of transaction in blockchain:
+ // -1 : not in blockchain, and not in memory pool (conflicted transaction)
+ // 0 : in memory pool, waiting to be included in a block
+ // >=1 : this many blocks deep in the main chain
int GetDepthInMainChain(CBlockIndex* &pindexRet) const;
int GetDepthInMainChain() const { CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet); }
- bool IsInMainChain() const { return GetDepthInMainChain() > 0; }
+ bool IsInMainChain() const { CBlockIndex *pindexRet; return GetDepthInMainChainINTERNAL(pindexRet) > 0; }
int GetBlocksToMaturity() const;
bool AcceptToMemoryPool(bool fLimitFree=true);
};