aboutsummaryrefslogtreecommitdiff
path: root/main.h
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-11-09 19:47:07 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-11-09 19:47:07 +0000
commite2a186af10d81a0e27b2e7c34783711d65caeae7 (patch)
tree166a47e465ecd961b6f7b52f9c22d307ecfb09d4 /main.h
parent461764cbbea5965ebbd248f221876743d7a9ccd4 (diff)
downloadbitcoin-e2a186af10d81a0e27b2e7c34783711d65caeae7.tar.xz
SelectCoins first pass tries not to use coins with less than 6 confirmations
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@177 1a98c847-1fd6-4fd8-948a-caf3550aa51b
Diffstat (limited to 'main.h')
-rw-r--r--main.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/main.h b/main.h
index 5176d90cea..d5734103c0 100644
--- a/main.h
+++ b/main.h
@@ -487,6 +487,11 @@ public:
return false;
}
+ bool IsFromMe() const
+ {
+ return (GetDebit() > 0);
+ }
+
int64 GetDebit() const
{
int64 nDebit = 0;
@@ -789,8 +794,23 @@ public:
return nCreditCached;
}
+ bool IsFromMe() const
+ {
+ return (GetDebit() > 0);
+ }
+
bool IsConfirmed() const
{
+ // Quick answer in most cases
+ if (!IsFinal())
+ return false;
+ if (GetDepthInMainChain() >= 1)
+ return true;
+ if (!IsFromMe()) // using wtx's cached debit
+ return false;
+
+ // If no confirmations but it's from us, we can still
+ // consider it confirmed if all dependencies are confirmed
map<uint256, const CMerkleTx*> mapPrev;
vector<const CMerkleTx*> vWorkQueue;
vWorkQueue.reserve(vtxPrev.size()+1);
@@ -803,7 +823,7 @@ public:
return false;
if (ptx->GetDepthInMainChain() >= 1)
return true;
- if (ptx->GetDebit() <= 0)
+ if (!ptx->IsFromMe())
return false;
if (mapPrev.empty())