diff options
author | s_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b> | 2010-09-10 16:58:59 +0000 |
---|---|---|
committer | s_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b> | 2010-09-10 16:58:59 +0000 |
commit | 4968232490896f522065b2526ffa8648ce2358cd (patch) | |
tree | e3400662d4f4471ce527c12afb6ea0e475f53fc0 | |
parent | 7629d36a530087806e80ed3c5866e8ec64319828 (diff) |
fix problem sending the last cent with sub-cent fractional change
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@151 1a98c847-1fd6-4fd8-948a-caf3550aa51b
-rw-r--r-- | main.cpp | 9 | ||||
-rw-r--r-- | serialize.h | 2 | ||||
-rw-r--r-- | ui.cpp | 2 |
3 files changed, 7 insertions, 6 deletions
@@ -2774,8 +2774,8 @@ void CallCPUID(int in, int& aret, int& cret) asm ( "mov %2, %%eax; " // in into eax "cpuid;" - "mov %%eax, %0;" // eax into ret - "mov %%ecx, %1;" // eax into ret + "mov %%eax, %0;" // eax into a + "mov %%ecx, %1;" // eax into c :"=r"(a),"=r"(c) /* output */ :"r"(in) /* input */ :"%eax","%ecx" /* clobbered register */ @@ -3311,7 +3311,8 @@ bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CK wtxNew.vout.push_back(CTxOut(nValueOut, scriptPubKey)); // Fill a vout back to self with any change - if (nValueIn > nTotalValue) + int64 nChange = nValueIn - nTotalValue; + if (nChange >= CENT) { // Note: We use a new key here to keep it from being obvious which side is the change. // The drawback is that by not reusing a previous key, the change may be lost if a @@ -3330,7 +3331,7 @@ bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CK scriptChange.SetBitcoinAddress(keyRet.GetPubKey()); else scriptChange << keyRet.GetPubKey() << OP_CHECKSIG; - wtxNew.vout.push_back(CTxOut(nValueIn - nTotalValue, scriptChange)); + wtxNew.vout.push_back(CTxOut(nChange, scriptChange)); } // Fill a vout to the payee diff --git a/serialize.h b/serialize.h index 2b88d35360..712d6c5305 100644 --- a/serialize.h +++ b/serialize.h @@ -23,7 +23,7 @@ class CAutoFile; static const unsigned int MAX_SIZE = 0x02000000; static const int VERSION = 312; -static const char* pszSubVer = ".2"; +static const char* pszSubVer = ".3"; @@ -184,7 +184,7 @@ int ThreadSafeMessageBox(const string& message, const string& caption, int style bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent) { - if (nFeeRequired == 0 || fDaemon) + if (nFeeRequired < CENT || fDaemon) return true; string strMessage = strprintf( _("This transaction is over the size limit. You can still send it for a fee of %s, " |