ignore IX confirmations when forming new tx

This commit is contained in:
Evan Duffield 2015-02-01 10:11:49 -07:00
parent b1d701275a
commit 1377b71347
3 changed files with 9 additions and 7 deletions

View File

@ -1179,17 +1179,19 @@ int CMerkleTx::IsTransactionLocked() const
return 0;
}
int CMerkleTx::GetDepthInMainChain(CBlockIndex* &pindexRet) const
int CMerkleTx::GetDepthInMainChain(CBlockIndex* &pindexRet, bool enableIX) const
{
AssertLockHeld(cs_main);
int nResult = GetDepthInMainChainINTERNAL(pindexRet);
if (nResult == 0 && !mempool.exists(GetHash()))
return -1; // Not in chain, not in mempool
if(enableIX){
if (nResult < 6){
int minConfirms = IsTransactionLocked();
return minConfirms+nResult;
}
}
return nResult;
}

View File

@ -480,8 +480,8 @@ public:
// -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); }
int GetDepthInMainChain(CBlockIndex* &pindexRet, bool enableIX=true) const;
int GetDepthInMainChain(bool enableIX=true) const { CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet, enableIX); }
bool IsInMainChain() const { CBlockIndex *pindexRet; return GetDepthInMainChainINTERNAL(pindexRet) > 0; }
int GetBlocksToMaturity() const;
bool AcceptToMemoryPool(bool fLimitFree=true);

View File

@ -1249,7 +1249,7 @@ void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const
if (pcoin->IsCoinBase() && pcoin->GetBlocksToMaturity() > 0)
continue;
int nDepth = pcoin->GetDepthInMainChain();
int nDepth = pcoin->GetDepthInMainChain(false);
if (nDepth < minimum_confirmations)
continue;