diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bitcoinrpc.cpp | 3 | ||||
-rw-r--r-- | src/init.cpp | 6 | ||||
-rw-r--r-- | src/main.cpp | 3 | ||||
-rw-r--r-- | src/makefile.linux-mingw | 12 | ||||
-rw-r--r-- | src/makefile.mingw | 12 | ||||
-rw-r--r-- | src/makefile.osx | 12 | ||||
-rw-r--r-- | src/makefile.unix | 7 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 2 | ||||
-rw-r--r-- | src/qt/transactionrecord.cpp | 12 | ||||
-rw-r--r-- | src/qt/transactiontablemodel.cpp | 4 | ||||
-rw-r--r-- | src/rpcrawtransaction.cpp | 6 | ||||
-rw-r--r-- | src/rpcwallet.cpp | 61 | ||||
-rw-r--r-- | src/script.cpp | 3 | ||||
-rw-r--r-- | src/wallet.cpp | 24 | ||||
-rw-r--r-- | src/wallet.h | 12 |
15 files changed, 90 insertions, 89 deletions
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index c144f5fbad..2271ff07c4 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -104,8 +104,7 @@ Value ValueFromAmount(int64 amount) return (double)amount / (double)COIN; } -std::string -HexBits(unsigned int nBits) +std::string HexBits(unsigned int nBits) { union { int32_t nBits; diff --git a/src/init.cpp b/src/init.cpp index 1a1e31c2f3..25756c4e6f 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -500,6 +500,12 @@ bool AppInit2() SetLimited(net); } } +#if defined(USE_IPV6) +#if ! USE_IPV6 + else + SetLimited(NET_IPV6); +#endif +#endif CService addrProxy; bool fProxy = false; diff --git a/src/main.cpp b/src/main.cpp index 91aba149bc..56596ef183 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -653,8 +653,7 @@ bool CTxMemPool::remove(CTransaction &tx) return true; } -void -CTxMemPool::clear() +void CTxMemPool::clear() { LOCK(cs); mapTx.clear(); diff --git a/src/makefile.linux-mingw b/src/makefile.linux-mingw index e22a9f38ea..ad74aa6c91 100644 --- a/src/makefile.linux-mingw +++ b/src/makefile.linux-mingw @@ -5,6 +5,7 @@ DEPSDIR:=/usr/i586-mingw32msvc USE_UPNP:=0 +USE_IPV6:=1 INCLUDEPATHS= \ -I"$(CURDIR)" \ @@ -28,18 +29,25 @@ LIBS= \ -l ssl \ -l crypto -DEFS=-D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6 +DEFS=-D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE DEBUGFLAGS=-g CFLAGS=-O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data) -ifdef USE_UPNP +ifndef USE_UPNP + override USE_UPNP = - +endif +ifneq (${USE_UPNP}, -) LIBPATHS += -L"$(DEPSDIR)/miniupnpc" LIBS += -l miniupnpc -l iphlpapi DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP) endif +ifneq (${USE_IPV6}, -) + DEFS += -DUSE_IPV6=$(USE_IPV6) +endif + LIBS += -l mingwthrd -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l mswsock -l shlwapi # TODO: make the mingw builds smarter about dependencies, like the linux/osx builds are diff --git a/src/makefile.mingw b/src/makefile.mingw index 74897656a9..6102dad613 100644 --- a/src/makefile.mingw +++ b/src/makefile.mingw @@ -3,6 +3,7 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. USE_UPNP:=0 +USE_IPV6:=1 INCLUDEPATHS= \ -I"C:\boost-1.49.0-mgw" \ @@ -23,19 +24,26 @@ LIBS= \ -l ssl \ -l crypto -DEFS=-DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6 +DEFS=-DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE DEBUGFLAGS=-g CFLAGS=-mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data) -ifdef USE_UPNP +ifndef USE_UPNP + override USE_UPNP = - +endif +ifneq (${USE_UPNP}, -) INCLUDEPATHS += -I"C:\miniupnpc-1.6-mgw" LIBPATHS += -L"C:\miniupnpc-1.6-mgw" LIBS += -l miniupnpc -l iphlpapi DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP) endif +ifneq (${USE_IPV6}, -) + DEFS += -DUSE_IPV6=$(USE_IPV6) +endif + LIBS += -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l mswsock -l shlwapi # TODO: make the mingw builds smarter about dependencies, like the linux/osx builds are diff --git a/src/makefile.osx b/src/makefile.osx index 977878398c..de829b9eb1 100644 --- a/src/makefile.osx +++ b/src/makefile.osx @@ -20,6 +20,7 @@ LIBPATHS= \ -L"$(DEPSDIR)/lib/db48" USE_UPNP:=1 +USE_IPV6:=1 LIBS= -dead_strip @@ -53,7 +54,7 @@ LIBS += \ TESTDEFS += -DBOOST_TEST_DYN_LINK endif -DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6 +DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 -DBOOST_SPIRIT_THREADSAFE ifdef RELEASE # Compile for maximum compatibility and smallest size. @@ -96,7 +97,10 @@ OBJS= \ obj/walletdb.o \ obj/noui.o -ifdef USE_UPNP +ifndef USE_UPNP + override USE_UPNP = - +endif +ifneq (${USE_UPNP}, -) DEFS += -DUSE_UPNP=$(USE_UPNP) ifdef STATIC LIBS += $(DEPSDIR)/lib/libminiupnpc.a @@ -105,6 +109,10 @@ else endif endif +ifneq (${USE_IPV6}, -) + DEFS += -DUSE_IPV6=$(USE_IPV6) +endif + all: bitcoind # auto-generated dependencies: diff --git a/src/makefile.unix b/src/makefile.unix index c9a09ad020..ac42743d8e 100644 --- a/src/makefile.unix +++ b/src/makefile.unix @@ -3,10 +3,11 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. USE_UPNP:=0 +USE_IPV6:=1 LINK:=$(CXX) -DEFS=-DUSE_IPV6 -DBOOST_SPIRIT_THREADSAFE +DEFS=-DBOOST_SPIRIT_THREADSAFE DEFS += $(addprefix -I,$(CURDIR) $(CURDIR)/obj $(BOOST_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH)) LIBS = $(addprefix -L,$(BOOST_LIB_PATH) $(BDB_LIB_PATH) $(OPENSSL_LIB_PATH)) @@ -43,6 +44,10 @@ ifneq (${USE_UPNP}, -) DEFS += -DUSE_UPNP=$(USE_UPNP) endif +ifneq (${USE_IPV6}, -) + DEFS += -DUSE_IPV6=$(USE_IPV6) +endif + LIBS+= \ -Wl,-B$(LMODE2) \ -l z \ diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 7e6ad15d6a..b81b832a87 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -257,7 +257,7 @@ void BitcoinGUI::createActions() aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About Bitcoin"), this); aboutAction->setToolTip(tr("Show information about Bitcoin")); aboutAction->setMenuRole(QAction::AboutRole); - aboutQtAction = new QAction(tr("About &Qt"), this); + aboutQtAction = new QAction(QIcon(":/trolltech/qmessagebox/images/qtlogo-64.png"), tr("About &Qt"), this); aboutQtAction->setToolTip(tr("Show information about Qt")); aboutQtAction->setMenuRole(QAction::AboutQtRole); optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this); diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 160973638d..cc60e2732b 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -54,12 +54,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet * CTxDestination address; sub.idx = parts.size(); // sequence number sub.credit = txout.nValue; - if (wtx.IsCoinBase()) - { - // Generated - sub.type = TransactionRecord::Generated; - } - else if (ExtractDestination(txout.scriptPubKey, address) && IsMine(*wallet, address)) + if (ExtractDestination(txout.scriptPubKey, address) && IsMine(*wallet, address)) { // Received by Bitcoin Address sub.type = TransactionRecord::RecvWithAddress; @@ -71,6 +66,11 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet * sub.type = TransactionRecord::RecvFromOther; sub.address = mapValue["from"]; } + if (wtx.IsCoinBase()) + { + // Generated + sub.type = TransactionRecord::Generated; + } parts.append(sub); } diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index b3e001ea1d..847c9e9733 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -392,11 +392,11 @@ QString TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, b return QString::fromStdString(wtx->address); case TransactionRecord::RecvWithAddress: case TransactionRecord::SendToAddress: + case TransactionRecord::Generated: return lookupAddress(wtx->address, tooltip); case TransactionRecord::SendToOther: return QString::fromStdString(wtx->address); case TransactionRecord::SendToSelf: - case TransactionRecord::Generated: default: return tr("(n/a)"); } @@ -409,13 +409,13 @@ QVariant TransactionTableModel::addressColor(const TransactionRecord *wtx) const { case TransactionRecord::RecvWithAddress: case TransactionRecord::SendToAddress: + case TransactionRecord::Generated: { QString label = walletModel->getAddressTableModel()->labelForAddress(QString::fromStdString(wtx->address)); if(label.isEmpty()) return COLOR_BAREADDRESS; } break; case TransactionRecord::SendToSelf: - case TransactionRecord::Generated: return COLOR_BAREADDRESS; default: break; diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index 2b6f4f7a4b..08b0049b08 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -18,8 +18,7 @@ using namespace boost; using namespace boost::assign; using namespace json_spirit; -void -ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out) +void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out) { txnouttype type; vector<CTxDestination> addresses; @@ -43,8 +42,7 @@ ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out) out.push_back(Pair("addresses", a)); } -void -TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry) +void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry) { entry.push_back(Pair("txid", tx.GetHash().GetHex())); entry.push_back(Pair("version", tx.nVersion)); diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index a32eb7801f..be83b85c15 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -15,16 +15,14 @@ using namespace std; int64 nWalletUnlockTime; static CCriticalSection cs_nWalletUnlockTime; -std::string -HelpRequiringPassphrase() +std::string HelpRequiringPassphrase() { return pwalletMain->IsCrypted() ? "\nrequires wallet passphrase to be set with walletpassphrase first" : ""; } -void -EnsureWalletIsUnlocked() +void EnsureWalletIsUnlocked() { if (pwalletMain->IsLocked()) throw JSONRPCError(-13, "Error: Please enter the wallet passphrase with walletpassphrase first."); @@ -34,6 +32,8 @@ void WalletTxToJSON(const CWalletTx& wtx, Object& entry) { int confirms = wtx.GetDepthInMainChain(); entry.push_back(Pair("confirmations", confirms)); + if (wtx.IsCoinBase()) + entry.push_back(Pair("generated", true)); if (confirms) { entry.push_back(Pair("blockhash", wtx.hashBlock.GetHex())); @@ -476,12 +476,12 @@ int64 GetAccountBalance(CWalletDB& walletdb, const string& strAccount, int nMinD if (!wtx.IsFinal()) continue; - int64 nGenerated, nReceived, nSent, nFee; - wtx.GetAccountAmounts(strAccount, nGenerated, nReceived, nSent, nFee); + int64 nReceived, nSent, nFee; + wtx.GetAccountAmounts(strAccount, nReceived, nSent, nFee); if (nReceived != 0 && wtx.GetDepthInMainChain() >= nMinDepth) nBalance += nReceived; - nBalance += nGenerated - nSent - nFee; + nBalance -= nSent + nFee; } // Tally internal accounting entries @@ -523,12 +523,11 @@ Value getbalance(const Array& params, bool fHelp) if (!wtx.IsFinal()) continue; - int64 allGeneratedImmature, allGeneratedMature, allFee; - allGeneratedImmature = allGeneratedMature = allFee = 0; + int64 allFee; string strSentAccount; list<pair<CTxDestination, int64> > listReceived; list<pair<CTxDestination, int64> > listSent; - wtx.GetAmounts(allGeneratedImmature, allGeneratedMature, listReceived, listSent, allFee, strSentAccount); + wtx.GetAmounts(listReceived, listSent, allFee, strSentAccount); if (wtx.GetDepthInMainChain() >= nMinDepth) { BOOST_FOREACH(const PAIRTYPE(CTxDestination,int64)& r, listReceived) @@ -537,7 +536,6 @@ Value getbalance(const Array& params, bool fHelp) BOOST_FOREACH(const PAIRTYPE(CTxDestination,int64)& r, listSent) nBalance -= r.second; nBalance -= allFee; - nBalance += allGeneratedMature; } return ValueFromAmount(nBalance); } @@ -908,35 +906,15 @@ Value listreceivedbyaccount(const Array& params, bool fHelp) void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDepth, bool fLong, Array& ret) { - int64 nGeneratedImmature, nGeneratedMature, nFee; + int64 nFee; string strSentAccount; list<pair<CTxDestination, int64> > listReceived; list<pair<CTxDestination, int64> > listSent; - wtx.GetAmounts(nGeneratedImmature, nGeneratedMature, listReceived, listSent, nFee, strSentAccount); + wtx.GetAmounts(listReceived, listSent, nFee, strSentAccount); bool fAllAccounts = (strAccount == string("*")); - // Generated blocks assigned to account "" - if ((nGeneratedMature+nGeneratedImmature) != 0 && (fAllAccounts || strAccount == "")) - { - Object entry; - entry.push_back(Pair("account", string(""))); - if (nGeneratedImmature) - { - entry.push_back(Pair("category", wtx.GetDepthInMainChain() ? "immature" : "orphan")); - entry.push_back(Pair("amount", ValueFromAmount(nGeneratedImmature))); - } - else - { - entry.push_back(Pair("category", "generate")); - entry.push_back(Pair("amount", ValueFromAmount(nGeneratedMature))); - } - if (fLong) - WalletTxToJSON(wtx, entry); - ret.push_back(entry); - } - // Sent if ((!listSent.empty() || nFee != 0) && (fAllAccounts || strAccount == strSentAccount)) { @@ -967,7 +945,17 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe Object entry; entry.push_back(Pair("account", account)); entry.push_back(Pair("address", CBitcoinAddress(r.first).ToString())); - entry.push_back(Pair("category", "receive")); + if (wtx.IsCoinBase()) + { + if (wtx.GetDepthInMainChain() < 1) + entry.push_back(Pair("category", "orphan")); + else if (wtx.GetBlocksToMaturity() > 0) + entry.push_back(Pair("category", "immature")); + else + entry.push_back(Pair("category", "generate")); + } + else + entry.push_back(Pair("category", "receive")); entry.push_back(Pair("amount", ValueFromAmount(r.second))); if (fLong) WalletTxToJSON(wtx, entry); @@ -1071,17 +1059,16 @@ Value listaccounts(const Array& params, bool fHelp) for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); it != pwalletMain->mapWallet.end(); ++it) { const CWalletTx& wtx = (*it).second; - int64 nGeneratedImmature, nGeneratedMature, nFee; + int64 nFee; string strSentAccount; list<pair<CTxDestination, int64> > listReceived; list<pair<CTxDestination, int64> > listSent; - wtx.GetAmounts(nGeneratedImmature, nGeneratedMature, listReceived, listSent, nFee, strSentAccount); + wtx.GetAmounts(listReceived, listSent, nFee, strSentAccount); mapAccountBalances[strSentAccount] -= nFee; BOOST_FOREACH(const PAIRTYPE(CTxDestination, int64)& s, listSent) mapAccountBalances[strSentAccount] -= s.second; if (wtx.GetDepthInMainChain() >= nMinDepth) { - mapAccountBalances[""] += nGeneratedMature; BOOST_FOREACH(const PAIRTYPE(CTxDestination, int64)& r, listReceived) if (pwalletMain->mapAddressBook.count(r.first)) mapAccountBalances[pwalletMain->mapAddressBook[r.first]] += r.second; diff --git a/src/script.cpp b/src/script.cpp index 8c35f0eed5..c34fbec82d 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -1127,8 +1127,7 @@ public: return false; } - void - Set(uint256 hash, const std::vector<unsigned char>& vchSig, const std::vector<unsigned char>& pubKey) + void Set(uint256 hash, const std::vector<unsigned char>& vchSig, const std::vector<unsigned char>& pubKey) { // DoS prevention: limit cache size to less than 10MB // (~200 bytes per cache entry times 50,000 entries) diff --git a/src/wallet.cpp b/src/wallet.cpp index a5a4e7e431..dc019d4924 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -601,23 +601,14 @@ int CWalletTx::GetRequestCount() const return nRequests; } -void CWalletTx::GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, list<pair<CTxDestination, int64> >& listReceived, +void CWalletTx::GetAmounts(list<pair<CTxDestination, int64> >& listReceived, list<pair<CTxDestination, int64> >& listSent, int64& nFee, string& strSentAccount) const { - nGeneratedImmature = nGeneratedMature = nFee = 0; + nFee = 0; listReceived.clear(); listSent.clear(); strSentAccount = strFromAccount; - if (IsCoinBase()) - { - if (GetBlocksToMaturity() > 0) - nGeneratedImmature = pwallet->GetCredit(*this); - else - nGeneratedMature = GetCredit(); - return; - } - // Compute fee: int64 nDebit = GetDebit(); if (nDebit > 0) // debit>0 means we signed/sent this transaction @@ -650,20 +641,17 @@ void CWalletTx::GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, l } -void CWalletTx::GetAccountAmounts(const string& strAccount, int64& nGenerated, int64& nReceived, +void CWalletTx::GetAccountAmounts(const string& strAccount, int64& nReceived, int64& nSent, int64& nFee) const { - nGenerated = nReceived = nSent = nFee = 0; + nReceived = nSent = nFee = 0; - int64 allGeneratedImmature, allGeneratedMature, allFee; - allGeneratedImmature = allGeneratedMature = allFee = 0; + int64 allFee; string strSentAccount; list<pair<CTxDestination, int64> > listReceived; list<pair<CTxDestination, int64> > listSent; - GetAmounts(allGeneratedImmature, allGeneratedMature, listReceived, listSent, allFee, strSentAccount); + GetAmounts(listReceived, listSent, allFee, strSentAccount); - if (strAccount == "") - nGenerated = allGeneratedMature; if (strAccount == strSentAccount) { BOOST_FOREACH(const PAIRTYPE(CTxDestination,int64)& s, listSent) diff --git a/src/wallet.h b/src/wallet.h index 428cff7480..44f8a17d37 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -322,9 +322,7 @@ public: typedef std::map<std::string, std::string> mapValue_t; -static -void -ReadOrderPos(int64& nOrderPos, mapValue_t& mapValue) +static void ReadOrderPos(int64& nOrderPos, mapValue_t& mapValue) { if (!mapValue.count("n")) { @@ -335,9 +333,7 @@ ReadOrderPos(int64& nOrderPos, mapValue_t& mapValue) } -static -void -WriteOrderPos(const int64& nOrderPos, mapValue_t& mapValue) +static void WriteOrderPos(const int64& nOrderPos, mapValue_t& mapValue) { if (nOrderPos == -1) return; @@ -592,10 +588,10 @@ public: return nChangeCached; } - void GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, std::list<std::pair<CTxDestination, int64> >& listReceived, + void GetAmounts(std::list<std::pair<CTxDestination, int64> >& listReceived, std::list<std::pair<CTxDestination, int64> >& listSent, int64& nFee, std::string& strSentAccount) const; - void GetAccountAmounts(const std::string& strAccount, int64& nGenerated, int64& nReceived, + void GetAccountAmounts(const std::string& strAccount, int64& nReceived, int64& nSent, int64& nFee) const; bool IsFromMe() const |