aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bitcoin-qt.pro4
-rw-r--r--contrib/gitian-descriptors/gitian-win32.yml22
-rw-r--r--contrib/gitian-descriptors/gitian.yml4
-rw-r--r--doc/build-unix.txt1
-rw-r--r--src/init.cpp70
-rw-r--r--src/irc.cpp17
-rw-r--r--src/makefile.osx5
-rw-r--r--src/net.cpp2
-rw-r--r--src/script.cpp2
-rw-r--r--src/test/multisig_tests.cpp5
-rw-r--r--src/util.cpp17
-rw-r--r--src/util.h25
12 files changed, 117 insertions, 57 deletions
diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro
index b690faecd7..2352230049 100644
--- a/bitcoin-qt.pro
+++ b/bitcoin-qt.pro
@@ -283,8 +283,8 @@ macx:ICON = src/qt/res/icons/bitcoin.icns
macx:TARGET = "Bitcoin-Qt"
# Set libraries and includes at end, to use platform-defined defaults if not overridden
-INCLUDEPATH += $$BOOST_INCLUDE_PATH $$BDB_INCLUDE_PATH $$OPENSSL_INCLUDE_PATH
-LIBS += $$join(BOOST_LIB_PATH,,-L,) $$join(BDB_LIB_PATH,,-L,) $$join(OPENSSL_LIB_PATH,,-L,)
+INCLUDEPATH += $$BOOST_INCLUDE_PATH $$BDB_INCLUDE_PATH $$OPENSSL_INCLUDE_PATH $$QRENCODE_INCLUDE_PATH
+LIBS += $$join(BOOST_LIB_PATH,,-L,) $$join(BDB_LIB_PATH,,-L,) $$join(OPENSSL_LIB_PATH,,-L,) $$join(QRENCODE_LIB_PATH,,-L,)
LIBS += -lssl -lcrypto -ldb_cxx$$BDB_LIB_SUFFIX
# -lgdi32 has to happen after -lcrypto (see #681)
windows:LIBS += -lgdi32
diff --git a/contrib/gitian-descriptors/gitian-win32.yml b/contrib/gitian-descriptors/gitian-win32.yml
index a3b93ed07d..493b61ca53 100644
--- a/contrib/gitian-descriptors/gitian-win32.yml
+++ b/contrib/gitian-descriptors/gitian-win32.yml
@@ -21,6 +21,9 @@ files:
- "openssl-1.0.0e.tar.gz"
- "db-4.8.30.NC.tar.gz"
- "miniupnpc-1.6.tar.gz"
+- "zlib-1.2.5.tar.gz"
+- "libpng-1.5.7.tar.gz"
+- "qrencode-3.2.0.tar.bz2"
script: |
#
mkdir $HOME/qt
@@ -62,6 +65,23 @@ script: |
cd ..
mv miniupnpc-1.6 miniupnpc
#
+ tar xzf zlib-1.2.5.tar.gz
+ cd zlib-1.2.5
+ make -f win32/Makefile.gcc PREFIX=i586-mingw32msvc- $MAKEOPTS
+ cd ..
+ #
+ tar xzf libpng-1.5.7.tar.gz
+ cd libpng-1.5.7
+ ./configure CC=i586-mingw32msvc-cc AR=i586-mingw32msvc-ar STRIP=i586-mingw32msvc-strip RANLIB=i586-mingw32msvc-ranlib OBJDUMP=i586-mingw32msvc-objdump LD=i586-mingw32msvc-ld LDFLAGS="-L../zlib-1.2.5/" CFLAGS="-I../zlib-1.2.5/"
+ make $MAKEOPTS
+ cd ..
+ #
+ tar xjf qrencode-3.2.0.tar.bz2
+ cd qrencode-3.2.0
+ ./configure CC=i586-mingw32msvc-cc AR=i586-mingw32msvc-ar STRIP=i586-mingw32msvc-strip RANLIB=i586-mingw32msvc-ranlib OBJDUMP=i586-mingw32msvc-objdump LD=i586-mingw32msvc-ld png_LIBS="../libpng-1.5.7/.libs/libpng15.a ../zlib-1.2.5/libz.a" png_CFLAGS="-I../libpng-1.5.7"
+ make $MAKEOPTS
+ cd ..
+ #
cd bitcoin
mkdir -p $OUTDIR/src
cp -a . $OUTDIR/src
@@ -71,7 +91,7 @@ script: |
export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
export FAKETIME=$REFERENCE_DATETIME
export TZ=UTC
- $HOME/qt/src/bin/qmake -spec unsupported/win32-g++-cross USE_SSL=1 MINIUPNPC_LIB_PATH=$HOME/build/miniupnpc MINIUPNPC_INCLUDE_PATH=$HOME/build/ BDB_LIB_PATH=$HOME/build/db-4.8.30.NC/build_unix BDB_INCLUDE_PATH=$HOME/build/db-4.8.30.NC/build_unix BOOST_LIB_PATH=$HOME/build/boost_1_47_0/stage/lib BOOST_INCLUDE_PATH=$HOME/build/boost_1_47_0 BOOST_LIB_SUFFIX=-mt-s BOOST_THREAD_LIB_SUFFIX=_win32-mt-s OPENSSL_LIB_PATH=$HOME/build/openssl-1.0.0e OPENSSL_INCLUDE_PATH=$HOME/build/openssl-1.0.0e/include INCLUDEPATH=$HOME/build DEFINES=BOOST_THREAD_USE_LIB BITCOIN_NEED_QT_PLUGINS=1 QMAKE_LRELEASE=lrelease QMAKE_CXXFLAGS=-frandom-seed=bitcoin QMAKE_LFLAGS=-frandom-seed=bitcoin
+ $HOME/qt/src/bin/qmake -spec unsupported/win32-g++-cross USE_SSL=1 MINIUPNPC_LIB_PATH=$HOME/build/miniupnpc MINIUPNPC_INCLUDE_PATH=$HOME/build/ BDB_LIB_PATH=$HOME/build/db-4.8.30.NC/build_unix BDB_INCLUDE_PATH=$HOME/build/db-4.8.30.NC/build_unix BOOST_LIB_PATH=$HOME/build/boost_1_47_0/stage/lib BOOST_INCLUDE_PATH=$HOME/build/boost_1_47_0 BOOST_LIB_SUFFIX=-mt-s BOOST_THREAD_LIB_SUFFIX=_win32-mt-s OPENSSL_LIB_PATH=$HOME/build/openssl-1.0.0e OPENSSL_INCLUDE_PATH=$HOME/build/openssl-1.0.0e/include QRENCODE_LIB_PATH=$HOME/build/qrencode-3.2.0/.libs QRENCODE_INCLUDE_PATH=$HOME/build/qrencode-3.2.0 USE_QRCODE=1 INCLUDEPATH=$HOME/build DEFINES=BOOST_THREAD_USE_LIB BITCOIN_NEED_QT_PLUGINS=1 QMAKE_LRELEASE=lrelease QMAKE_CXXFLAGS=-frandom-seed=bitcoin QMAKE_LFLAGS=-frandom-seed=bitcoin
make $MAKEOPTS
cp release/bitcoin-qt.exe $OUTDIR/
#
diff --git a/contrib/gitian-descriptors/gitian.yml b/contrib/gitian-descriptors/gitian.yml
index 903a9dc291..8a0ee0e038 100644
--- a/contrib/gitian-descriptors/gitian.yml
+++ b/contrib/gitian-descriptors/gitian.yml
@@ -16,7 +16,7 @@ packages:
- "libssl-dev"
- "git-core"
- "unzip"
-- "qrencode"
+- "libqrencode-dev"
reference_datetime: "2011-01-30 00:00:00"
remotes:
- "url": "https://github.com/bitcoin/bitcoin.git"
@@ -44,6 +44,6 @@ script: |
mkdir -p $OUTDIR/bin/$GBUILD_BITS
install -s bitcoind $OUTDIR/bin/$GBUILD_BITS
cd ..
- qmake INCLUDEPATH="$INSTDIR/include" LIBS="-L$INSTDIR/lib" RELEASE=1 USE_SSL=1
+ qmake INCLUDEPATH="$INSTDIR/include" LIBS="-L$INSTDIR/lib" RELEASE=1 USE_SSL=1 USE_QRCODE=1
make $MAKEOPTS
install bitcoin-qt $OUTDIR/bin/$GBUILD_BITS
diff --git a/doc/build-unix.txt b/doc/build-unix.txt
index 538933984c..e1a1805aa3 100644
--- a/doc/build-unix.txt
+++ b/doc/build-unix.txt
@@ -65,6 +65,7 @@ sudo apt-get install libdb4.8-dev
sudo apt-get install libdb4.8++-dev
Boost 1.40+: sudo apt-get install libboost-all-dev
or Boost 1.37: sudo apt-get install libboost1.37-dev
+sudo apt-get install libqrencode-dev
If using Boost 1.37, append -mt to the boost libraries in the makefile.
diff --git a/src/init.cpp b/src/init.cpp
index 1e389b226b..0eb5b529f1 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -194,6 +194,7 @@ bool AppInit2(int argc, char* argv[])
" -maxconnections=<n>\t " + _("Maintain at most <n> connections to peers (default: 125)") + "\n" +
" -addnode=<ip> \t " + _("Add a node to connect to") + "\n" +
" -connect=<ip> \t\t " + _("Connect only to the specified node") + "\n" +
+ " -noirc \t " + _("Don't find peers using internet relay chat") + "\n" +
" -nolisten \t " + _("Don't accept connections from outside") + "\n" +
" -nodnsseed \t " + _("Don't bootstrap list of peers using DNS") + "\n" +
" -banscore=<n> \t " + _("Threshold for disconnecting misbehaving peers (default: 100)") + "\n" +
@@ -248,7 +249,6 @@ bool AppInit2(int argc, char* argv[])
}
fDebug = GetBoolArg("-debug");
- fAllowDNS = GetBoolArg("-dns");
#ifndef WIN32
fDaemon = GetBoolArg("-daemon");
@@ -267,10 +267,6 @@ bool AppInit2(int argc, char* argv[])
#endif
fPrintToConsole = GetBoolArg("-printtoconsole");
fPrintToDebugger = GetBoolArg("-printtodebugger");
-
- fTestNet = GetBoolArg("-testnet");
- bool fTOR = (fUseProxy && addrProxy.port == htons(9050));
- fNoListen = GetBoolArg("-nolisten") || fTOR;
fLogTimestamps = GetBoolArg("-logtimestamps");
#ifndef QT_GUI
@@ -332,17 +328,6 @@ bool AppInit2(int argc, char* argv[])
return false;
}
- // Bind to the port early so we can tell if another instance is already running.
- if (!fNoListen)
- {
- std::string strError;
- if (!BindListenPort(strError))
- {
- wxMessageBox(strError, "Bitcoin");
- return false;
- }
- }
-
std::ostringstream strErrors;
//
// Load data files
@@ -428,6 +413,10 @@ bool AppInit2(int argc, char* argv[])
// Add wallet transactions that aren't already in a block to mapTransactions
pwalletMain->ReacceptWalletTransactions();
+ // Note: Bitcoin-QT stores several settings in the wallet, so we want
+ // to load the wallet BEFORE parsing command-line arguments, so
+ // the command-line/bitcoin.conf settings override GUI setting.
+
//
// Parameters
//
@@ -480,6 +469,44 @@ bool AppInit2(int argc, char* argv[])
}
}
+ fTestNet = GetBoolArg("-testnet");
+ bool fTor = (fUseProxy && addrProxy.port == htons(9050));
+ if (fTor)
+ {
+ // Use SoftSetArg here so user can override any of these if they wish.
+ // Note: the GetBoolArg() calls for all of these must happen later.
+ SoftSetArg("-nolisten", true);
+ SoftSetArg("-noirc", true);
+ SoftSetArg("-nodnsseed", true);
+ SoftSetArg("-noupnp", true);
+ SoftSetArg("-upnp", false);
+ SoftSetArg("-dns", false);
+ }
+
+ fAllowDNS = GetBoolArg("-dns");
+ fNoListen = GetBoolArg("-nolisten");
+
+ if (fHaveUPnP)
+ {
+#if USE_UPNP
+ if (GetBoolArg("-noupnp"))
+ fUseUPnP = false;
+#else
+ if (GetBoolArg("-upnp"))
+ fUseUPnP = true;
+#endif
+ }
+
+ if (!fNoListen)
+ {
+ std::string strError;
+ if (!BindListenPort(strError))
+ {
+ wxMessageBox(strError, "Bitcoin");
+ return false;
+ }
+ }
+
if (mapArgs.count("-addnode"))
{
BOOST_FOREACH(string strAddr, mapMultiArgs["-addnode"])
@@ -502,17 +529,6 @@ bool AppInit2(int argc, char* argv[])
wxMessageBox(_("Warning: -paytxfee is set very high. This is the transaction fee you will pay if you send a transaction."), "Bitcoin", wxOK | wxICON_EXCLAMATION);
}
- if (fHaveUPnP)
- {
-#if USE_UPNP
- if (GetBoolArg("-noupnp"))
- fUseUPnP = false;
-#else
- if (GetBoolArg("-upnp"))
- fUseUPnP = true;
-#endif
- }
-
//
// Start the node
//
diff --git a/src/irc.cpp b/src/irc.cpp
index 5278488dcd..fe96a90a1c 100644
--- a/src/irc.cpp
+++ b/src/irc.cpp
@@ -264,19 +264,14 @@ void ThreadIRCSeed2(void* parg)
int nErrorWait = 10;
int nRetryWait = 10;
bool fNameInUse = false;
- bool fTOR = (fUseProxy && addrProxy.port == htons(9050));
while (!fShutdown)
{
- //CAddress addrConnect("216.155.130.130:6667"); // chat.freenode.net
CAddress addrConnect("92.243.23.21", 6667); // irc.lfnet.org
- if (!fTOR)
- {
- //struct hostent* phostent = gethostbyname("chat.freenode.net");
- CAddress addrIRC("irc.lfnet.org", 6667, true);
- if (addrIRC.IsValid())
- addrConnect = addrIRC;
- }
+
+ CAddress addrIRC("irc.lfnet.org", 6667, true);
+ if (addrIRC.IsValid())
+ addrConnect = addrIRC;
SOCKET hSocket;
if (!ConnectSocket(addrConnect, hSocket))
@@ -406,10 +401,6 @@ void ThreadIRCSeed2(void* parg)
closesocket(hSocket);
hSocket = INVALID_SOCKET;
- // IRC usually blocks TOR, so only try once
- if (fTOR)
- return;
-
if (GetTime() - nStart > 20 * 60)
{
nErrorWait /= 3;
diff --git a/src/makefile.osx b/src/makefile.osx
index cf5ec38d29..966829e222 100644
--- a/src/makefile.osx
+++ b/src/makefile.osx
@@ -96,11 +96,6 @@ else
endif
endif
-ifdef USE_QRCODE
- DEFS += -DUSE_QRCODE=$(USE_QRCODE)
- LIBS += -lqrencode
-endif
-
all: bitcoind
# auto-generated dependencies:
diff --git a/src/net.cpp b/src/net.cpp
index c204cb2d0c..6dab7e8c11 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1471,7 +1471,7 @@ void ThreadOpenConnections2(void* parg)
{
// Add seed nodes if IRC isn't working
bool fTOR = (fUseProxy && addrProxy.port == htons(9050));
- if (mapAddresses.empty() && (GetTime() - nStart > 60 || fTOR) && !fTestNet)
+ if (mapAddresses.empty() && (GetTime() - nStart > 60 || fUseProxy) && !fTestNet)
fAddSeeds = true;
}
diff --git a/src/script.cpp b/src/script.cpp
index f576e14a8b..34872808b3 100644
--- a/src/script.cpp
+++ b/src/script.cpp
@@ -1436,7 +1436,7 @@ bool IsMine(const CKeyStore &keystore, const CScript& scriptPubKey)
// them) enable spend-out-from-under-you attacks, especially
// in shared-wallet situations.
vector<valtype> keys(vSolutions.begin()+1, vSolutions.begin()+vSolutions.size()-1);
- return HaveKeys(vSolutions, keystore);
+ return HaveKeys(keys, keystore) == keys.size();
}
}
return false;
diff --git a/src/test/multisig_tests.cpp b/src/test/multisig_tests.cpp
index 742083f3cf..0c2e41aedd 100644
--- a/src/test/multisig_tests.cpp
+++ b/src/test/multisig_tests.cpp
@@ -174,7 +174,7 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1)
// one key that would satisfy an (a|b) or 2-of-3 keys needed
// to spend an escrow transaction.
//
- CBasicKeyStore keystore, emptykeystore;
+ CBasicKeyStore keystore, emptykeystore, partialkeystore;
CKey key[3];
CBitcoinAddress keyaddr[3];
for (int i = 0; i < 3; i++)
@@ -183,6 +183,7 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1)
keystore.AddKey(key[i]);
keyaddr[i].SetPubKey(key[i].GetPubKey());
}
+ partialkeystore.AddKey(key[0]);
{
vector<valtype> solutions;
@@ -221,6 +222,7 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1)
BOOST_CHECK(!ExtractAddress(s, addr));
BOOST_CHECK(IsMine(keystore, s));
BOOST_CHECK(!IsMine(emptykeystore, s));
+ BOOST_CHECK(!IsMine(partialkeystore, s));
}
{
vector<valtype> solutions;
@@ -237,6 +239,7 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1)
BOOST_CHECK(nRequired = 1);
BOOST_CHECK(IsMine(keystore, s));
BOOST_CHECK(!IsMine(emptykeystore, s));
+ BOOST_CHECK(!IsMine(partialkeystore, s));
}
{
vector<valtype> solutions;
diff --git a/src/util.cpp b/src/util.cpp
index a45ce33a1c..3805e077a1 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -470,6 +470,23 @@ void ParseParameters(int argc, char* argv[])
}
}
+bool SoftSetArg(const std::string& strArg, const std::string& strValue)
+{
+ if (mapArgs.count(strArg))
+ return false;
+ mapArgs[strArg] = strValue;
+ return true;
+}
+
+bool SoftSetArg(const std::string& strArg, bool fValue)
+{
+ if (fValue)
+ return SoftSetArg(strArg, std::string("1"));
+ else
+ return SoftSetArg(strArg, std::string("0"));
+}
+
+
string EncodeBase64(const unsigned char* pch, size_t len)
{
static const char *pbase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
diff --git a/src/util.h b/src/util.h
index bb90869962..48fea023bf 100644
--- a/src/util.h
+++ b/src/util.h
@@ -439,7 +439,7 @@ inline int64 GetArg(const std::string& strArg, int64 nDefault)
return nDefault;
}
-inline bool GetBoolArg(const std::string& strArg)
+inline bool GetBoolArg(const std::string& strArg, bool fDefault=false)
{
if (mapArgs.count(strArg))
{
@@ -447,9 +447,26 @@ inline bool GetBoolArg(const std::string& strArg)
return true;
return (atoi(mapArgs[strArg]) != 0);
}
- return false;
-}
-
+ return fDefault;
+}
+
+/**
+ * Set an argument if it doesn't already have a value
+ *
+ * @param strArg Argument to set (e.g. "-foo")
+ * @param strValue Value (e.g. "1")
+ * @return true if argument gets set, false if it already had a value
+ */
+bool SoftSetArg(const std::string& strArg, const std::string& strValue);
+
+/**
+ * Set a boolean argument if it doesn't already have a value
+ *
+ * @param strArg Argument to set (e.g. "-foo")
+ * @param fValue Value (e.g. false)
+ * @return true if argument gets set, false if it already had a value
+ */
+bool SoftSetArg(const std::string& strArg, bool fValue);