From 4968232490896f522065b2526ffa8648ce2358cd Mon Sep 17 00:00:00 2001 From: s_nakamoto Date: Fri, 10 Sep 2010 16:58:59 +0000 Subject: 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 --- main.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index e3c44145d..3919d7e85 100644 --- a/main.cpp +++ b/main.cpp @@ -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 -- cgit v1.2.3 From c39b06866eea2a17785d18e0c24f915606bd25bc Mon Sep 17 00:00:00 2001 From: s_nakamoto Date: Fri, 10 Sep 2010 18:07:48 +0000 Subject: fix build on non-intel architectures, thanks teknohog git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@152 1a98c847-1fd6-4fd8-948a-caf3550aa51b --- main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 3919d7e85..8d2fdde0e 100644 --- a/main.cpp +++ b/main.cpp @@ -2767,7 +2767,7 @@ inline void SHA256Transform(void* pstate, void* pinput, const void* pinit) static const int NPAR = 32; extern void Double_BlockSHA256(const void* pin, void* pout, const void* pinit, unsigned int hash[8][NPAR], const void* init2); -#ifdef __GNUC__ +#if defined(__GNUC__) && defined(CRYPTOPP_X86_ASM_AVAILABLE) void CallCPUID(int in, int& aret, int& cret) { int a, c; -- cgit v1.2.3