diff options
-rw-r--r-- | doc/build-msw.txt | 6 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 3 | ||||
-rw-r--r-- | src/qt/forms/signverifymessagedialog.ui | 2 | ||||
-rw-r--r-- | src/qt/walletmodel.cpp | 25 | ||||
-rw-r--r-- | src/util.h | 48 |
5 files changed, 59 insertions, 25 deletions
diff --git a/doc/build-msw.txt b/doc/build-msw.txt index ad23e68675..d4ae51d3f1 100644 --- a/doc/build-msw.txt +++ b/doc/build-msw.txt @@ -24,7 +24,7 @@ Dependencies Libraries you need to download separately and build: default path download -OpenSSL \openssl-1.0.1d-mgw http://www.openssl.org/source/ +OpenSSL \openssl-1.0.1b-mgw http://www.openssl.org/source/ Berkeley DB \db-4.8.30.NC-mgw http://www.oracle.com/technology/software/products/berkeley-db/index.html Boost \boost-1.47.0-mgw http://www.boost.org/users/download/ miniupnpc \miniupnpc-1.6-mgw http://miniupnp.tuxfamily.org/files/ @@ -36,7 +36,7 @@ Boost MIT-like license miniupnpc New (3-clause) BSD license Versions used in this release: -OpenSSL 1.0.1d +OpenSSL 1.0.1b Berkeley DB 4.8.30.NC Boost 1.47.0 miniupnpc 1.6 @@ -48,7 +48,7 @@ MSYS shell: un-tar sources with MSYS 'tar xfz' to avoid issue with symlinks (OpenSSL ticket 2377) change 'MAKE' env. variable from 'C:\MinGW32\bin\mingw32-make.exe' to '/c/MinGW32/bin/mingw32-make.exe' -cd /c/openssl-1.0.1d-mgw +cd /c/openssl-1.0.1b-mgw ./config make diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 878c2887a2..7b0e6f3bc0 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -344,6 +344,7 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel) this->clientModel = clientModel; if(clientModel) { + // Replace some strings and icons, when using the testnet if(clientModel->isTestNet()) { setWindowTitle(windowTitle() + QString(" ") + tr("[testnet]")); @@ -359,6 +360,8 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel) trayIcon->setIcon(QIcon(":/icons/toolbar_testnet")); toggleHideAction->setIcon(QIcon(":/icons/toolbar_testnet")); } + + aboutAction->setIcon(QIcon(":/icons/toolbar_testnet")); } // Keep up to date with client diff --git a/src/qt/forms/signverifymessagedialog.ui b/src/qt/forms/signverifymessagedialog.ui index e22aea8675..8128bdf457 100644 --- a/src/qt/forms/signverifymessagedialog.ui +++ b/src/qt/forms/signverifymessagedialog.ui @@ -11,7 +11,7 @@ </rect> </property> <property name="windowTitle"> - <string>Messaging - Sign / Verify a Message</string> + <string>Signatures - Sign / Verify a Message</string> </property> <property name="modal"> <bool>true</bool> diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 0111e0cd91..3568616cd3 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -23,13 +23,10 @@ WalletModel::WalletModel(CWallet *wallet, OptionsModel *optionsModel, QObject *p addressTableModel = new AddressTableModel(wallet, this); transactionTableModel = new TransactionTableModel(wallet, this); - // This single-shot timer will be fired from the 'checkBalancedChanged' - // method repeatedly while either of the unconfirmed or immature balances - // are non-zero + // This timer will be fired repeatedly to update the balance pollTimer = new QTimer(this); - pollTimer->setInterval(MODEL_UPDATE_DELAY); - pollTimer->setSingleShot(true); connect(pollTimer, SIGNAL(timeout()), this, SLOT(pollBalanceChanged())); + pollTimer->start(MODEL_UPDATE_DELAY); subscribeToCoreSignals(); } @@ -74,13 +71,12 @@ void WalletModel::updateStatus() void WalletModel::pollBalanceChanged() { - if(nBestHeight != cachedNumBlocks) { + if(nBestHeight != cachedNumBlocks) + { + // Balance and number of transactions might have changed cachedNumBlocks = nBestHeight; checkBalanceChanged(); } - - if(cachedUnconfirmedBalance || cachedImmatureBalance) - pollTimer->start(); } void WalletModel::checkBalanceChanged() @@ -89,7 +85,8 @@ void WalletModel::checkBalanceChanged() qint64 newUnconfirmedBalance = getUnconfirmedBalance(); qint64 newImmatureBalance = getImmatureBalance(); - if(cachedBalance != newBalance || cachedUnconfirmedBalance != newUnconfirmedBalance || cachedImmatureBalance != newImmatureBalance) { + if(cachedBalance != newBalance || cachedUnconfirmedBalance != newUnconfirmedBalance || cachedImmatureBalance != newImmatureBalance) + { cachedBalance = newBalance; cachedUnconfirmedBalance = newUnconfirmedBalance; cachedImmatureBalance = newImmatureBalance; @@ -105,13 +102,11 @@ void WalletModel::updateTransaction(const QString &hash, int status) // Balance and number of transactions might have changed checkBalanceChanged(); - if(cachedUnconfirmedBalance || cachedImmatureBalance) - pollTimer->start(); - int newNumTransactions = getNumTransactions(); - if(cachedNumTransactions != newNumTransactions) { - emit numTransactionsChanged(newNumTransactions); + if(cachedNumTransactions != newNumTransactions) + { cachedNumTransactions = newNumTransactions; + emit numTransactionsChanged(newNumTransactions); } } diff --git a/src/util.h b/src/util.h index 7b2c678916..7fe204c0df 100644 --- a/src/util.h +++ b/src/util.h @@ -391,6 +391,46 @@ inline uint256 Hash(const T1 pbegin, const T1 pend) return hash2; } +class CHashWriter +{ +private: + SHA256_CTX ctx; + +public: + int nType; + int nVersion; + + void Init() { + SHA256_Init(&ctx); + } + + CHashWriter(int nTypeIn, int nVersionIn) : nType(nTypeIn), nVersion(nVersionIn) { + Init(); + } + + CHashWriter& write(const char *pch, size_t size) { + SHA256_Update(&ctx, pch, size); + return (*this); + } + + // invalidates the object + uint256 GetHash() { + uint256 hash1; + SHA256_Final((unsigned char*)&hash1, &ctx); + uint256 hash2; + SHA256((unsigned char*)&hash1, sizeof(hash1), (unsigned char*)&hash2); + return hash2; + } + + template<typename T> + CHashWriter& operator<<(const T& obj) { + // Serialize to this stream + ::Serialize(*this, obj, nType, nVersion); + return (*this); + } +}; + + template<typename T1, typename T2> inline uint256 Hash(const T1 p1begin, const T1 p1end, const T2 p2begin, const T2 p2end) @@ -428,13 +468,9 @@ inline uint256 Hash(const T1 p1begin, const T1 p1end, template<typename T> uint256 SerializeHash(const T& obj, int nType=SER_GETHASH, int nVersion=PROTOCOL_VERSION) { - // Most of the time is spent allocating and deallocating CDataStream's - // buffer. If this ever needs to be optimized further, make a CStaticStream - // class with its buffer on the stack. - CDataStream ss(nType, nVersion); - ss.reserve(10000); + CHashWriter ss(nType, nVersion); ss << obj; - return Hash(ss.begin(), ss.end()); + return ss.GetHash(); } inline uint160 Hash160(const std::vector<unsigned char>& vch) |