diff options
51 files changed, 1311 insertions, 904 deletions
diff --git a/contrib/bitcoind.bash-completion b/contrib/bitcoind.bash-completion new file mode 100644 index 0000000000..dd6c1ce819 --- /dev/null +++ b/contrib/bitcoind.bash-completion @@ -0,0 +1,115 @@ +# bash programmable completion for bitcoind(1) +# Copyright (c) 2012 Christian von Roques <roques@mti.ag> +# Distributed under the MIT/X11 software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. + +have bitcoind && { + +# call $bitcoind for RPC +_bitcoin_rpc() { + # determine already specified args necessary for RPC + local rpcargs=() + for i in ${COMP_LINE}; do + case "$i" in + -conf=*|-proxy*|-rpc*) + rpcargs=( "${rpcargs[@]}" "$i" ) + ;; + esac + done + $bitcoind "${rpcargs[@]}" "$@" +} + +# Add bitcoin accounts to COMPREPLY +_bitcoin_accounts() { + local accounts + accounts=$(_bitcoin_rpc listaccounts | awk '/".*"/ { a=$1; gsub(/"/, "", a); print a}') + COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$accounts" -- "$cur" ) ) +} + +_bitcoind() { + local cur prev words=() cword + local bitcoind + + # save and use original argument to invoke bitcoind + # bitcoind might not be in $PATH + bitcoind="$1" + + COMPREPLY=() + _get_comp_words_by_ref -n = cur prev words cword + + if ((cword > 2)); then + case ${words[cword-2]} in + listreceivedbyaccount|listreceivedbyaddress) + COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) + return 0 + ;; + move|setaccount) + _bitcoin_accounts + return 0 + ;; + esac + fi + + case "$prev" in + backupwallet) + _filedir + return 0 + ;; + setgenerate) + COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) + return 0 + ;; + getaccountaddress|getaddressesbyaccount|getbalance|getnewaddress|getreceivedbyaccount|listtransactions|move|sendfrom|sendmany) + _bitcoin_accounts + return 0 + ;; + esac + + case "$cur" in + -conf=*|-pid=*|-rpcsslcertificatechainfile=*|-rpcsslprivatekeyfile=*) + cur="${cur#*=}" + _filedir + return 0 + ;; + -datadir=*) + cur="${cur#*=}" + _filedir -d + return 0 + ;; + -*=*) # prevent nonsense completions + return 0 + ;; + *) + local helpopts commands + + # only parse --help if senseful + if [[ -z "$cur" || "$cur" =~ ^- ]]; then + helpopts=$($bitcoind --help 2>&1 | awk '$1 ~ /^-/ { sub(/=.*/, "="); print $1 }' ) + fi + + # only parse help if senseful + if [[ -z "$cur" || "$cur" =~ ^[a-z] ]]; then + commands=$(_bitcoin_rpc help 2>/dev/null | awk '{ print $1; }') + fi + + COMPREPLY=( $( compgen -W "$helpopts $commands" -- "$cur" ) ) + + # Prevent space if an argument is desired + if [[ $COMPREPLY == *= ]]; then + compopt -o nospace + fi + return 0 + ;; + esac +} + +complete -F _bitcoind bitcoind +} + +# Local variables: +# mode: shell-script +# sh-basic-offset: 4 +# sh-indent-comment: t +# indent-tabs-mode: nil +# End: +# ex: ts=4 sw=4 et filetype=sh diff --git a/contrib/debian/bitcoind.bash-completion b/contrib/debian/bitcoind.bash-completion new file mode 100644 index 0000000000..0f84707b66 --- /dev/null +++ b/contrib/debian/bitcoind.bash-completion @@ -0,0 +1 @@ +contrib/bitcoind.bash-completion bitcoind diff --git a/contrib/debian/control b/contrib/debian/control index 745fd71ea8..de067d8fc4 100644 --- a/contrib/debian/control +++ b/contrib/debian/control @@ -5,6 +5,7 @@ Maintainer: Jonas Smedegaard <dr@jones.dk> Uploaders: Micah Anderson <micah@debian.org> Build-Depends: debhelper, devscripts, + bash-completion, libboost-system-dev (>> 1.35) | libboost-system1.35-dev, libdb4.8++-dev, libssl-dev, diff --git a/contrib/debian/rules b/contrib/debian/rules index 49c7766d13..98bb2bba1c 100755 --- a/contrib/debian/rules +++ b/contrib/debian/rules @@ -9,7 +9,7 @@ DEB_INSTALL_EXAMPLES_bitcoind += debian/examples/* DEB_INSTALL_MANPAGES_bitcoind += debian/manpages/* %: - dh $@ + dh --with bash-completion $@ override_dh_auto_build: cd src; $(MAKE) -f makefile.unix bitcoind diff --git a/doc/build-msw.txt b/doc/build-msw.txt index b1805154e1..73ea81275f 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.1b-mgw http://www.openssl.org/source/ +OpenSSL \openssl-1.0.1d-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.1b +OpenSSL 1.0.1d 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.1b-mgw +cd /c/openssl-1.0.1d-mgw ./config make diff --git a/src/base58.h b/src/base58.h index a4ff35c4a8..b492cd683c 100644 --- a/src/base58.h +++ b/src/base58.h @@ -19,6 +19,7 @@ #include <vector> #include "bignum.h" #include "key.h" +#include "script.h" static const char* pszBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; @@ -258,6 +259,18 @@ public: * Script-hash-addresses have version 5 (or 196 testnet). * The data vector contains RIPEMD160(SHA256(cscript)), where cscript is the serialized redemption script. */ +class CBitcoinAddress; +class CBitcoinAddressVisitor : public boost::static_visitor<bool> +{ +private: + CBitcoinAddress *addr; +public: + CBitcoinAddressVisitor(CBitcoinAddress *addrIn) : addr(addrIn) { } + bool operator()(const CKeyID &id) const; + bool operator()(const CScriptID &id) const; + bool operator()(const CNoDestination &no) const; +}; + class CBitcoinAddress : public CBase58Data { public: @@ -269,21 +282,19 @@ public: SCRIPT_ADDRESS_TEST = 196, }; - bool SetHash160(const uint160& hash160) - { - SetData(fTestNet ? PUBKEY_ADDRESS_TEST : PUBKEY_ADDRESS, &hash160, 20); + bool Set(const CKeyID &id) { + SetData(fTestNet ? PUBKEY_ADDRESS_TEST : PUBKEY_ADDRESS, &id, 20); return true; } - void SetPubKey(const std::vector<unsigned char>& vchPubKey) - { - SetHash160(Hash160(vchPubKey)); + bool Set(const CScriptID &id) { + SetData(fTestNet ? SCRIPT_ADDRESS_TEST : SCRIPT_ADDRESS, &id, 20); + return true; } - bool SetScriptHash160(const uint160& hash160) + bool Set(const CTxDestination &dest) { - SetData(fTestNet ? SCRIPT_ADDRESS_TEST : SCRIPT_ADDRESS, &hash160, 20); - return true; + return boost::apply_visitor(CBitcoinAddressVisitor(this), dest); } bool IsValid() const @@ -315,27 +326,14 @@ public: } return fExpectTestNet == fTestNet && vchData.size() == nExpectedSize; } - bool IsScript() const - { - if (!IsValid()) - return false; - if (fTestNet) - return nVersion == SCRIPT_ADDRESS_TEST; - return nVersion == SCRIPT_ADDRESS; - } CBitcoinAddress() { } - CBitcoinAddress(uint160 hash160In) - { - SetHash160(hash160In); - } - - CBitcoinAddress(const std::vector<unsigned char>& vchPubKey) + CBitcoinAddress(const CTxDestination &dest) { - SetPubKey(vchPubKey); + Set(dest); } CBitcoinAddress(const std::string& strAddress) @@ -348,15 +346,58 @@ public: SetString(pszAddress); } - uint160 GetHash160() const - { - assert(vchData.size() == 20); - uint160 hash160; - memcpy(&hash160, &vchData[0], 20); - return hash160; + CTxDestination Get() const { + if (!IsValid()) + return CNoDestination(); + switch (nVersion) { + case PUBKEY_ADDRESS: + case PUBKEY_ADDRESS_TEST: { + uint160 id; + memcpy(&id, &vchData[0], 20); + return CKeyID(id); + } + case SCRIPT_ADDRESS: + case SCRIPT_ADDRESS_TEST: { + uint160 id; + memcpy(&id, &vchData[0], 20); + return CScriptID(id); + } + } + return CNoDestination(); + } + + bool GetKeyID(CKeyID &keyID) const { + if (!IsValid()) + return false; + switch (nVersion) { + case PUBKEY_ADDRESS: + case PUBKEY_ADDRESS_TEST: { + uint160 id; + memcpy(&id, &vchData[0], 20); + keyID = CKeyID(id); + return true; + } + default: return false; + } + } + + bool IsScript() const { + if (!IsValid()) + return false; + switch (nVersion) { + case SCRIPT_ADDRESS: + case SCRIPT_ADDRESS_TEST: { + return true; + } + default: return false; + } } }; +bool inline CBitcoinAddressVisitor::operator()(const CKeyID &id) const { return addr->Set(id); } +bool inline CBitcoinAddressVisitor::operator()(const CScriptID &id) const { return addr->Set(id); } +bool inline CBitcoinAddressVisitor::operator()(const CNoDestination &id) const { return false; } + /** A base58-encoded secret key */ class CBitcoinSecret : public CBase58Data { diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 8f4fb93a5a..1e32f055bb 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -10,6 +10,7 @@ #include "net.h" #include "init.h" #include "ui_interface.h" +#include "base58.h" #include "bitcoinrpc.h" #undef printf @@ -184,10 +185,10 @@ ScriptSigToJSON(const CTxIn& txin, Object& out) return; txnouttype type; - vector<CBitcoinAddress> addresses; + vector<CTxDestination> addresses; int nRequired; - if (!ExtractAddresses(txprev.vout[txin.prevout.n].scriptPubKey, type, + if (!ExtractDestinations(txprev.vout[txin.prevout.n].scriptPubKey, type, addresses, nRequired)) { out.push_back(Pair("type", GetTxnOutputType(TX_NONSTANDARD))); @@ -202,8 +203,8 @@ ScriptSigToJSON(const CTxIn& txin, Object& out) } Array a; - BOOST_FOREACH(const CBitcoinAddress& addr, addresses) - a.push_back(addr.ToString()); + BOOST_FOREACH(const CTxDestination& addr, addresses) + a.push_back(CBitcoinAddress(addr).ToString()); out.push_back(Pair("addresses", a)); } @@ -211,13 +212,13 @@ void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out) { txnouttype type; - vector<CBitcoinAddress> addresses; + vector<CTxDestination> addresses; int nRequired; out.push_back(Pair("asm", scriptPubKey.ToString())); out.push_back(Pair("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end()))); - if (!ExtractAddresses(scriptPubKey, type, addresses, nRequired)) + if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired)) { out.push_back(Pair("type", GetTxnOutputType(TX_NONSTANDARD))); return; @@ -227,8 +228,8 @@ ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out) out.push_back(Pair("type", GetTxnOutputType(type))); Array a; - BOOST_FOREACH(const CBitcoinAddress& addr, addresses) - a.push_back(addr.ToString()); + BOOST_FOREACH(const CTxDestination& addr, addresses) + a.push_back(CBitcoinAddress(addr).ToString()); out.push_back(Pair("addresses", a)); } @@ -590,14 +591,14 @@ Value getnewaddress(const Array& params, bool fHelp) pwalletMain->TopUpKeyPool(); // Generate a new key that is added to wallet - std::vector<unsigned char> newKey; + CPubKey newKey; if (!pwalletMain->GetKeyFromPool(newKey, false)) throw JSONRPCError(-12, "Error: Keypool ran out, please call keypoolrefill first"); - CBitcoinAddress address(newKey); + CKeyID keyID = newKey.GetID(); - pwalletMain->SetAddressBookName(address, strAccount); + pwalletMain->SetAddressBookName(keyID, strAccount); - return address.ToString(); + return CBitcoinAddress(keyID).ToString(); } @@ -611,12 +612,12 @@ CBitcoinAddress GetAccountAddress(string strAccount, bool bForceNew=false) bool bKeyUsed = false; // Check if the current key has been used - if (!account.vchPubKey.empty()) + if (account.vchPubKey.IsValid()) { CScript scriptPubKey; - scriptPubKey.SetBitcoinAddress(account.vchPubKey); + scriptPubKey.SetDestination(account.vchPubKey.GetID()); for (map<uint256, CWalletTx>::iterator it = pwalletMain->mapWallet.begin(); - it != pwalletMain->mapWallet.end() && !account.vchPubKey.empty(); + it != pwalletMain->mapWallet.end() && account.vchPubKey.IsValid(); ++it) { const CWalletTx& wtx = (*it).second; @@ -627,16 +628,16 @@ CBitcoinAddress GetAccountAddress(string strAccount, bool bForceNew=false) } // Generate a new key - if (account.vchPubKey.empty() || bForceNew || bKeyUsed) + if (!account.vchPubKey.IsValid() || bForceNew || bKeyUsed) { if (!pwalletMain->GetKeyFromPool(account.vchPubKey, false)) throw JSONRPCError(-12, "Error: Keypool ran out, please call keypoolrefill first"); - pwalletMain->SetAddressBookName(CBitcoinAddress(account.vchPubKey), strAccount); + pwalletMain->SetAddressBookName(account.vchPubKey.GetID(), strAccount); walletdb.WriteAccount(strAccount, account); } - return CBitcoinAddress(account.vchPubKey); + return CBitcoinAddress(account.vchPubKey.GetID()); } Value getaccountaddress(const Array& params, bool fHelp) @@ -675,14 +676,14 @@ Value setaccount(const Array& params, bool fHelp) strAccount = AccountFromValue(params[1]); // Detect when changing the account of an address that is the 'unused current key' of another account: - if (pwalletMain->mapAddressBook.count(address)) + if (pwalletMain->mapAddressBook.count(address.Get())) { - string strOldAccount = pwalletMain->mapAddressBook[address]; + string strOldAccount = pwalletMain->mapAddressBook[address.Get()]; if (address == GetAccountAddress(strOldAccount)) GetAccountAddress(strOldAccount, true); } - pwalletMain->SetAddressBookName(address, strAccount); + pwalletMain->SetAddressBookName(address.Get(), strAccount); return Value::null; } @@ -700,7 +701,7 @@ Value getaccount(const Array& params, bool fHelp) throw JSONRPCError(-5, "Invalid Bitcoin address"); string strAccount; - map<CBitcoinAddress, string>::iterator mi = pwalletMain->mapAddressBook.find(address); + map<CTxDestination, string>::iterator mi = pwalletMain->mapAddressBook.find(address.Get()); if (mi != pwalletMain->mapAddressBook.end() && !(*mi).second.empty()) strAccount = (*mi).second; return strAccount; @@ -769,7 +770,7 @@ Value sendtoaddress(const Array& params, bool fHelp) if (pwalletMain->IsLocked()) throw JSONRPCError(-13, "Error: Please enter the wallet passphrase with walletpassphrase first."); - string strError = pwalletMain->SendMoneyToBitcoinAddress(address, nAmount, wtx); + string strError = pwalletMain->SendMoneyToDestination(address.Get(), nAmount, wtx); if (strError != "") throw JSONRPCError(-4, strError); @@ -792,8 +793,12 @@ Value signmessage(const Array& params, bool fHelp) if (!addr.IsValid()) throw JSONRPCError(-3, "Invalid address"); + CKeyID keyID; + if (!addr.GetKeyID(keyID)) + throw JSONRPCError(-3, "Address does not refer to key"); + CKey key; - if (!pwalletMain->GetKey(addr, key)) + if (!pwalletMain->GetKey(keyID, key)) throw JSONRPCError(-4, "Private key not available"); CDataStream ss(SER_GETHASH, 0); @@ -822,6 +827,10 @@ Value verifymessage(const Array& params, bool fHelp) if (!addr.IsValid()) throw JSONRPCError(-3, "Invalid address"); + CKeyID keyID; + if (!addr.GetKeyID(keyID)) + throw JSONRPCError(-3, "Address does not refer to key"); + bool fInvalid = false; vector<unsigned char> vchSig = DecodeBase64(strSign.c_str(), &fInvalid); @@ -836,7 +845,7 @@ Value verifymessage(const Array& params, bool fHelp) if (!key.SetCompactSignature(Hash(ss.begin(), ss.end()), vchSig)) return false; - return (CBitcoinAddress(key.GetPubKey()) == addr); + return (key.GetPubKey().GetID() == keyID); } @@ -852,7 +861,7 @@ Value getreceivedbyaddress(const Array& params, bool fHelp) CScript scriptPubKey; if (!address.IsValid()) throw JSONRPCError(-5, "Invalid Bitcoin address"); - scriptPubKey.SetBitcoinAddress(address); + scriptPubKey.SetDestination(address.Get()); if (!IsMine(*pwalletMain,scriptPubKey)) return (double)0.0; @@ -879,18 +888,17 @@ Value getreceivedbyaddress(const Array& params, bool fHelp) } -void GetAccountAddresses(string strAccount, set<CBitcoinAddress>& setAddress) +void GetAccountAddresses(string strAccount, set<CTxDestination>& setAddress) { - BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress, string)& item, pwalletMain->mapAddressBook) + BOOST_FOREACH(const PAIRTYPE(CTxDestination, string)& item, pwalletMain->mapAddressBook) { - const CBitcoinAddress& address = item.first; + const CTxDestination& address = item.first; const string& strName = item.second; if (strName == strAccount) setAddress.insert(address); } } - Value getreceivedbyaccount(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) @@ -905,7 +913,7 @@ Value getreceivedbyaccount(const Array& params, bool fHelp) // Get the set of pub keys assigned to account string strAccount = AccountFromValue(params[0]); - set<CBitcoinAddress> setAddress; + set<CTxDestination> setAddress; GetAccountAddresses(strAccount, setAddress); // Tally @@ -918,8 +926,8 @@ Value getreceivedbyaccount(const Array& params, bool fHelp) BOOST_FOREACH(const CTxOut& txout, wtx.vout) { - CBitcoinAddress address; - if (ExtractAddress(txout.scriptPubKey, address) && pwalletMain->HaveKey(address) && setAddress.count(address)) + CTxDestination address; + if (ExtractDestination(txout.scriptPubKey, address) && IsMine(*pwalletMain, address) && setAddress.count(address)) if (wtx.GetDepthInMainChain() >= nMinDepth) nAmount += txout.nValue; } @@ -990,15 +998,15 @@ Value getbalance(const Array& params, bool fHelp) int64 allGeneratedImmature, allGeneratedMature, allFee; allGeneratedImmature = allGeneratedMature = allFee = 0; string strSentAccount; - list<pair<CBitcoinAddress, int64> > listReceived; - list<pair<CBitcoinAddress, int64> > listSent; + list<pair<CTxDestination, int64> > listReceived; + list<pair<CTxDestination, int64> > listSent; wtx.GetAmounts(allGeneratedImmature, allGeneratedMature, listReceived, listSent, allFee, strSentAccount); if (wtx.GetDepthInMainChain() >= nMinDepth) { - BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress,int64)& r, listReceived) + BOOST_FOREACH(const PAIRTYPE(CTxDestination,int64)& r, listReceived) nBalance += r.second; } - BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress,int64)& r, listSent) + BOOST_FOREACH(const PAIRTYPE(CTxDestination,int64)& r, listSent) nBalance -= r.second; nBalance -= allFee; nBalance += allGeneratedMature; @@ -1094,7 +1102,7 @@ Value sendfrom(const Array& params, bool fHelp) throw JSONRPCError(-6, "Account has insufficient funds"); // Send - string strError = pwalletMain->SendMoneyToBitcoinAddress(address, nAmount, wtx); + string strError = pwalletMain->SendMoneyToDestination(address.Get(), nAmount, wtx); if (strError != "") throw JSONRPCError(-4, strError); @@ -1136,7 +1144,7 @@ Value sendmany(const Array& params, bool fHelp) setAddress.insert(address); CScript scriptPubKey; - scriptPubKey.SetBitcoinAddress(address); + scriptPubKey.SetDestination(address.Get()); int64 nAmount = AmountFromValue(s.value_); totalAmount += nAmount; @@ -1200,22 +1208,23 @@ Value addmultisigaddress(const Array& params, bool fHelp) CBitcoinAddress address(ks); if (address.IsValid()) { - if (address.IsScript()) + CKeyID keyID; + if (!address.GetKeyID(keyID)) throw runtime_error( - strprintf("%s is a pay-to-script address",ks.c_str())); - std::vector<unsigned char> vchPubKey; - if (!pwalletMain->GetPubKey(address, vchPubKey)) + strprintf("%s does not refer to a key",ks.c_str())); + CPubKey vchPubKey; + if (!pwalletMain->GetPubKey(keyID, vchPubKey)) throw runtime_error( strprintf("no full public key for address %s",ks.c_str())); - if (vchPubKey.empty() || !pubkeys[i].SetPubKey(vchPubKey)) + if (!vchPubKey.IsValid() || !pubkeys[i].SetPubKey(vchPubKey)) throw runtime_error(" Invalid public key: "+ks); } // Case 2: hex public key else if (IsHex(ks)) { - vector<unsigned char> vchPubKey = ParseHex(ks); - if (vchPubKey.empty() || !pubkeys[i].SetPubKey(vchPubKey)) + CPubKey vchPubKey(ParseHex(ks)); + if (!vchPubKey.IsValid() || !pubkeys[i].SetPubKey(vchPubKey)) throw runtime_error(" Invalid public key: "+ks); } else @@ -1227,16 +1236,11 @@ Value addmultisigaddress(const Array& params, bool fHelp) // Construct using pay-to-script-hash: CScript inner; inner.SetMultisig(nRequired, pubkeys); - - uint160 scriptHash = Hash160(inner); - CScript scriptPubKey; - scriptPubKey.SetPayToScriptHash(inner); + CScriptID innerID = inner.GetID(); pwalletMain->AddCScript(inner); - CBitcoinAddress address; - address.SetScriptHash160(scriptHash); - pwalletMain->SetAddressBookName(address, strAccount); - return address.ToString(); + pwalletMain->SetAddressBookName(innerID, strAccount); + return CBitcoinAddress(innerID).ToString(); } @@ -1278,8 +1282,8 @@ Value ListReceived(const Array& params, bool fByAccounts) BOOST_FOREACH(const CTxOut& txout, wtx.vout) { - CBitcoinAddress address; - if (!ExtractAddress(txout.scriptPubKey, address) || !pwalletMain->HaveKey(address) || !address.IsValid()) + CTxDestination address; + if (!ExtractDestination(txout.scriptPubKey, address) || !IsMine(*pwalletMain, address)) continue; tallyitem& item = mapTally[address]; @@ -1376,8 +1380,8 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe { int64 nGeneratedImmature, nGeneratedMature, nFee; string strSentAccount; - list<pair<CBitcoinAddress, int64> > listReceived; - list<pair<CBitcoinAddress, int64> > listSent; + list<pair<CTxDestination, int64> > listReceived; + list<pair<CTxDestination, int64> > listSent; wtx.GetAmounts(nGeneratedImmature, nGeneratedMature, listReceived, listSent, nFee, strSentAccount); @@ -1406,11 +1410,11 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe // Sent if ((!listSent.empty() || nFee != 0) && (fAllAccounts || strAccount == strSentAccount)) { - BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress, int64)& s, listSent) + BOOST_FOREACH(const PAIRTYPE(CTxDestination, int64)& s, listSent) { Object entry; entry.push_back(Pair("account", strSentAccount)); - entry.push_back(Pair("address", s.first.ToString())); + entry.push_back(Pair("address", CBitcoinAddress(s.first).ToString())); entry.push_back(Pair("category", "send")); entry.push_back(Pair("amount", ValueFromAmount(-s.second))); entry.push_back(Pair("fee", ValueFromAmount(-nFee))); @@ -1423,7 +1427,7 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe // Received if (listReceived.size() > 0 && wtx.GetDepthInMainChain() >= nMinDepth) { - BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress, int64)& r, listReceived) + BOOST_FOREACH(const PAIRTYPE(CTxDestination, int64)& r, listReceived) { string account; if (pwalletMain->mapAddressBook.count(r.first)) @@ -1432,7 +1436,7 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe { Object entry; entry.push_back(Pair("account", account)); - entry.push_back(Pair("address", r.first.ToString())); + entry.push_back(Pair("address", CBitcoinAddress(r.first).ToString())); entry.push_back(Pair("category", "receive")); entry.push_back(Pair("amount", ValueFromAmount(r.second))); if (fLong) @@ -1547,8 +1551,8 @@ Value listaccounts(const Array& params, bool fHelp) nMinDepth = params[0].get_int(); map<string, int64> mapAccountBalances; - BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress, string)& entry, pwalletMain->mapAddressBook) { - if (pwalletMain->HaveKey(entry.first)) // This address belongs to me + BOOST_FOREACH(const PAIRTYPE(CTxDestination, string)& entry, pwalletMain->mapAddressBook) { + if (IsMine(*pwalletMain, entry.first)) // This address belongs to me mapAccountBalances[entry.second] = 0; } @@ -1557,16 +1561,16 @@ Value listaccounts(const Array& params, bool fHelp) const CWalletTx& wtx = (*it).second; int64 nGeneratedImmature, nGeneratedMature, nFee; string strSentAccount; - list<pair<CBitcoinAddress, int64> > listReceived; - list<pair<CBitcoinAddress, int64> > listSent; + list<pair<CTxDestination, int64> > listReceived; + list<pair<CTxDestination, int64> > listSent; wtx.GetAmounts(nGeneratedImmature, nGeneratedMature, listReceived, listSent, nFee, strSentAccount); mapAccountBalances[strSentAccount] -= nFee; - BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress, int64)& s, listSent) + BOOST_FOREACH(const PAIRTYPE(CTxDestination, int64)& s, listSent) mapAccountBalances[strSentAccount] -= s.second; if (wtx.GetDepthInMainChain() >= nMinDepth) { mapAccountBalances[""] += nGeneratedMature; - BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress, int64)& r, listReceived) + BOOST_FOREACH(const PAIRTYPE(CTxDestination, int64)& r, listReceived) if (pwalletMain->mapAddressBook.count(r.first)) mapAccountBalances[pwalletMain->mapAddressBook[r.first]] += r.second; else @@ -1932,6 +1936,40 @@ Value encryptwallet(const Array& params, bool fHelp) return "wallet encrypted; Bitcoin server stopping, restart to run with encrypted wallet"; } +class DescribeAddressVisitor : public boost::static_visitor<Object> +{ +public: + Object operator()(const CNoDestination &dest) const { return Object(); } + + Object operator()(const CKeyID &keyID) const { + Object obj; + CPubKey vchPubKey; + pwalletMain->GetPubKey(keyID, vchPubKey); + obj.push_back(Pair("isscript", false)); + obj.push_back(Pair("pubkey", HexStr(vchPubKey.Raw()))); + obj.push_back(Pair("iscompressed", vchPubKey.IsCompressed())); + return obj; + } + + Object operator()(const CScriptID &scriptID) const { + Object obj; + obj.push_back(Pair("isscript", true)); + CScript subscript; + pwalletMain->GetCScript(scriptID, subscript); + std::vector<CTxDestination> addresses; + txnouttype whichType; + int nRequired; + ExtractDestinations(subscript, whichType, addresses, nRequired); + obj.push_back(Pair("script", GetTxnOutputType(whichType))); + Array a; + BOOST_FOREACH(const CTxDestination& addr, addresses) + a.push_back(CBitcoinAddress(addr).ToString()); + obj.push_back(Pair("addresses", a)); + if (whichType == TX_MULTISIG) + obj.push_back(Pair("sigsrequired", nRequired)); + return obj; + } +}; Value validateaddress(const Array& params, bool fHelp) { @@ -1947,42 +1985,17 @@ Value validateaddress(const Array& params, bool fHelp) ret.push_back(Pair("isvalid", isValid)); if (isValid) { - // Call Hash160ToAddress() so we always return current ADDRESSVERSION - // version of the address: + CTxDestination dest = address.Get(); string currentAddress = address.ToString(); ret.push_back(Pair("address", currentAddress)); - if (pwalletMain->HaveKey(address)) - { - ret.push_back(Pair("ismine", true)); - std::vector<unsigned char> vchPubKey; - pwalletMain->GetPubKey(address, vchPubKey); - ret.push_back(Pair("pubkey", HexStr(vchPubKey))); - CKey key; - key.SetPubKey(vchPubKey); - ret.push_back(Pair("iscompressed", key.IsCompressed())); - } - else if (pwalletMain->HaveCScript(address.GetHash160())) - { - ret.push_back(Pair("isscript", true)); - CScript subscript; - pwalletMain->GetCScript(address.GetHash160(), subscript); - ret.push_back(Pair("ismine", ::IsMine(*pwalletMain, subscript))); - std::vector<CBitcoinAddress> addresses; - txnouttype whichType; - int nRequired; - ExtractAddresses(subscript, whichType, addresses, nRequired); - ret.push_back(Pair("script", GetTxnOutputType(whichType))); - Array a; - BOOST_FOREACH(const CBitcoinAddress& addr, addresses) - a.push_back(addr.ToString()); - ret.push_back(Pair("addresses", a)); - if (whichType == TX_MULTISIG) - ret.push_back(Pair("sigsrequired", nRequired)); + bool fMine = IsMine(*pwalletMain, dest); + ret.push_back(Pair("ismine", fMine)); + if (fMine) { + Object detail = boost::apply_visitor(DescribeAddressVisitor(), dest); + ret.insert(ret.end(), detail.begin(), detail.end()); } - else - ret.push_back(Pair("ismine", false)); - if (pwalletMain->mapAddressBook.count(address)) - ret.push_back(Pair("account", pwalletMain->mapAddressBook[address])); + if (pwalletMain->mapAddressBook.count(dest)) + ret.push_back(Pair("account", pwalletMain->mapAddressBook[dest])); } return ret; } @@ -2248,7 +2261,7 @@ Value sendrawtx(const Array& params, bool fHelp) CInv inv(MSG_TX, tx.GetHash()); RelayInventory(inv); - return true; + return tx.GetHash().GetHex(); } @@ -2976,24 +2989,11 @@ Array RPCConvertValues(const std::string &strMethod, const std::vector<std::stri if (strMethod == "listaccounts" && n > 0) ConvertTo<boost::int64_t>(params[0]); if (strMethod == "walletpassphrase" && n > 1) ConvertTo<boost::int64_t>(params[1]); if (strMethod == "listsinceblock" && n > 1) ConvertTo<boost::int64_t>(params[1]); - if (strMethod == "sendmany" && n > 1) - { - string s = params[1].get_str(); - Value v; - if (!read_string(s, v) || v.type() != obj_type) - throw runtime_error("type mismatch"); - params[1] = v.get_obj(); - } - if (strMethod == "sendmany" && n > 2) ConvertTo<boost::int64_t>(params[2]); - if (strMethod == "addmultisigaddress" && n > 0) ConvertTo<boost::int64_t>(params[0]); - if (strMethod == "addmultisigaddress" && n > 1) - { - string s = params[1].get_str(); - Value v; - if (!read_string(s, v) || v.type() != array_type) - throw runtime_error("type mismatch "+s); - params[1] = v.get_array(); - } + if (strMethod == "sendmany" && n > 1) ConvertTo<Object>(params[1]); + if (strMethod == "sendmany" && n > 2) ConvertTo<boost::int64_t>(params[2]); + if (strMethod == "addmultisigaddress" && n > 0) ConvertTo<boost::int64_t>(params[0]); + if (strMethod == "addmultisigaddress" && n > 1) ConvertTo<Array>(params[1]); + return params; } diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp index 6679bc93d4..6f7a92bb25 100644 --- a/src/checkpoints.cpp +++ b/src/checkpoints.cpp @@ -35,27 +35,32 @@ namespace Checkpoints (168000, uint256("0x000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763")) ; + static MapCheckpoints mapCheckpointsTestnet = + boost::assign::map_list_of + ( 546, uint256("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70")) + ; + bool CheckBlock(int nHeight, const uint256& hash) { - if (fTestNet) return true; // Testnet has no checkpoints + MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints); - MapCheckpoints::const_iterator i = mapCheckpoints.find(nHeight); - if (i == mapCheckpoints.end()) return true; + MapCheckpoints::const_iterator i = checkpoints.find(nHeight); + if (i == checkpoints.end()) return true; return hash == i->second; } int GetTotalBlocksEstimate() { - if (fTestNet) return 0; + MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints); - return mapCheckpoints.rbegin()->first; + return checkpoints.rbegin()->first; } CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex) { - if (fTestNet) return NULL; + MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints); - BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, mapCheckpoints) + BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, checkpoints) { const uint256& hash = i.second; std::map<uint256, CBlockIndex*>::const_iterator t = mapBlockIndex.find(hash); diff --git a/src/init.cpp b/src/init.cpp index c01dc27086..687cb9a9d1 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -414,6 +414,7 @@ bool AppInit2() ShrinkDebugFile(); printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); printf("Bitcoin version %s (%s)\n", FormatFullVersion().c_str(), CLIENT_DATE.c_str()); + printf("Startup time: %s\n", DateTimeStrFormat("%x %H:%M:%S", GetTime()).c_str()); printf("Default data directory %s\n", GetDefaultDataDir().string().c_str()); std::ostringstream strErrors; @@ -604,11 +605,11 @@ bool AppInit2() // Create new keyUser and set as default key RandAddSeedPerfmon(); - std::vector<unsigned char> newDefaultKey; + CPubKey newDefaultKey; if (!pwalletMain->GetKeyFromPool(newDefaultKey, false)) strErrors << _("Cannot initialize keypool") << "\n"; pwalletMain->SetDefaultKey(newDefaultKey); - if (!pwalletMain->SetAddressBookName(CBitcoinAddress(pwalletMain->vchDefaultKey), "")) + if (!pwalletMain->SetAddressBookName(pwalletMain->vchDefaultKey.GetID(), "")) strErrors << _("Cannot write default address") << "\n"; } diff --git a/src/irc.cpp b/src/irc.cpp index 1049188411..c0b3b7478d 100644 --- a/src/irc.cpp +++ b/src/irc.cpp @@ -291,8 +291,8 @@ void ThreadIRCSeed2(void* parg) } if (fTestNet) { - Send(hSocket, "JOIN #bitcoinTEST\r"); - Send(hSocket, "WHO #bitcoinTEST\r"); + Send(hSocket, "JOIN #bitcoinTEST3\r"); + Send(hSocket, "WHO #bitcoinTEST3\r"); } else { // randomly join #bitcoin00-#bitcoin99 int channel_number = GetRandInt(100); diff --git a/src/key.cpp b/src/key.cpp index 9485b477cb..57ab842bc4 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -239,18 +239,18 @@ CPrivKey CKey::GetPrivKey() const return vchPrivKey; } -bool CKey::SetPubKey(const std::vector<unsigned char>& vchPubKey) +bool CKey::SetPubKey(const CPubKey& vchPubKey) { - const unsigned char* pbegin = &vchPubKey[0]; - if (!o2i_ECPublicKey(&pkey, &pbegin, vchPubKey.size())) + const unsigned char* pbegin = &vchPubKey.vchPubKey[0]; + if (!o2i_ECPublicKey(&pkey, &pbegin, vchPubKey.vchPubKey.size())) return false; fSet = true; - if (vchPubKey.size() == 33) + if (vchPubKey.vchPubKey.size() == 33) SetCompressedPubKey(); return true; } -std::vector<unsigned char> CKey::GetPubKey() const +CPubKey CKey::GetPubKey() const { int nSize = i2o_ECPublicKey(pkey, NULL); if (!nSize) @@ -259,7 +259,7 @@ std::vector<unsigned char> CKey::GetPubKey() const unsigned char* pbegin = &vchPubKey[0]; if (i2o_ECPublicKey(pkey, &pbegin) != nSize) throw key_error("CKey::GetPubKey() : i2o_ECPublicKey returned unexpected size"); - return vchPubKey; + return CPubKey(vchPubKey); } bool CKey::Sign(uint256 hash, std::vector<unsigned char>& vchSig) @@ -9,7 +9,9 @@ #include <vector> #include "allocators.h" +#include "serialize.h" #include "uint256.h" +#include "util.h" #include <openssl/ec.h> // for EC_KEY definition @@ -42,6 +44,60 @@ public: explicit key_error(const std::string& str) : std::runtime_error(str) {} }; +/** A reference to a CKey: the Hash160 of its serialized public key */ +class CKeyID : public uint160 +{ +public: + CKeyID() : uint160(0) { } + CKeyID(const uint160 &in) : uint160(in) { } +}; + +/** A reference to a CScript: the Hash160 of its serialization (see script.h) */ +class CScriptID : public uint160 +{ +public: + CScriptID() : uint160(0) { } + CScriptID(const uint160 &in) : uint160(in) { } +}; + +/** An encapsulated public key. */ +class CPubKey { +private: + std::vector<unsigned char> vchPubKey; + friend class CKey; + +public: + CPubKey() { } + CPubKey(const std::vector<unsigned char> &vchPubKeyIn) : vchPubKey(vchPubKeyIn) { } + friend bool operator==(const CPubKey &a, const CPubKey &b) { return a.vchPubKey == b.vchPubKey; } + friend bool operator!=(const CPubKey &a, const CPubKey &b) { return a.vchPubKey != b.vchPubKey; } + friend bool operator<(const CPubKey &a, const CPubKey &b) { return a.vchPubKey < b.vchPubKey; } + + IMPLEMENT_SERIALIZE( + READWRITE(vchPubKey); + ) + + CKeyID GetID() const { + return CKeyID(Hash160(vchPubKey)); + } + + uint256 GetHash() const { + return Hash(vchPubKey.begin(), vchPubKey.end()); + } + + bool IsValid() const { + return vchPubKey.size() == 33 || vchPubKey.size() == 65; + } + + bool IsCompressed() const { + return vchPubKey.size() == 33; + } + + std::vector<unsigned char> Raw() const { + return vchPubKey; + } +}; + // secure_allocator is defined in serialize.h // CPrivKey is a serialized private key, with all parameters included (279 bytes) @@ -78,8 +134,8 @@ public: bool SetSecret(const CSecret& vchSecret, bool fCompressed = false); CSecret GetSecret(bool &fCompressed) const; CPrivKey GetPrivKey() const; - bool SetPubKey(const std::vector<unsigned char>& vchPubKey); - std::vector<unsigned char> GetPubKey() const; + bool SetPubKey(const CPubKey& vchPubKey); + CPubKey GetPubKey() const; bool Sign(uint256 hash, std::vector<unsigned char>& vchSig); diff --git a/src/keystore.cpp b/src/keystore.cpp index c56e820e0f..e0cf805a19 100644 --- a/src/keystore.cpp +++ b/src/keystore.cpp @@ -6,7 +6,7 @@ #include "keystore.h" #include "script.h" -bool CKeyStore::GetPubKey(const CBitcoinAddress &address, std::vector<unsigned char> &vchPubKeyOut) const +bool CKeyStore::GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const { CKey key; if (!GetKey(address, key)) @@ -21,7 +21,7 @@ bool CBasicKeyStore::AddKey(const CKey& key) CSecret secret = key.GetSecret(fCompressed); { LOCK(cs_KeyStore); - mapKeys[CBitcoinAddress(key.GetPubKey())] = make_pair(secret, fCompressed); + mapKeys[key.GetPubKey().GetID()] = make_pair(secret, fCompressed); } return true; } @@ -30,12 +30,12 @@ bool CBasicKeyStore::AddCScript(const CScript& redeemScript) { { LOCK(cs_KeyStore); - mapScripts[Hash160(redeemScript)] = redeemScript; + mapScripts[redeemScript.GetID()] = redeemScript; } return true; } -bool CBasicKeyStore::HaveCScript(const uint160& hash) const +bool CBasicKeyStore::HaveCScript(const CScriptID& hash) const { bool result; { @@ -46,7 +46,7 @@ bool CBasicKeyStore::HaveCScript(const uint160& hash) const } -bool CBasicKeyStore::GetCScript(const uint160 &hash, CScript& redeemScriptOut) const +bool CBasicKeyStore::GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const { { LOCK(cs_KeyStore); @@ -97,10 +97,10 @@ bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn) CryptedKeyMap::const_iterator mi = mapCryptedKeys.begin(); for (; mi != mapCryptedKeys.end(); ++mi) { - const std::vector<unsigned char> &vchPubKey = (*mi).second.first; + const CPubKey &vchPubKey = (*mi).second.first; const std::vector<unsigned char> &vchCryptedSecret = (*mi).second.second; CSecret vchSecret; - if(!DecryptSecret(vMasterKeyIn, vchCryptedSecret, Hash(vchPubKey.begin(), vchPubKey.end()), vchSecret)) + if(!DecryptSecret(vMasterKeyIn, vchCryptedSecret, vchPubKey.GetHash(), vchSecret)) return false; if (vchSecret.size() != 32) return false; @@ -128,9 +128,9 @@ bool CCryptoKeyStore::AddKey(const CKey& key) return false; std::vector<unsigned char> vchCryptedSecret; - std::vector<unsigned char> vchPubKey = key.GetPubKey(); + CPubKey vchPubKey = key.GetPubKey(); bool fCompressed; - if (!EncryptSecret(vMasterKey, key.GetSecret(fCompressed), Hash(vchPubKey.begin(), vchPubKey.end()), vchCryptedSecret)) + if (!EncryptSecret(vMasterKey, key.GetSecret(fCompressed), vchPubKey.GetHash(), vchCryptedSecret)) return false; if (!AddCryptedKey(key.GetPubKey(), vchCryptedSecret)) @@ -140,19 +140,19 @@ bool CCryptoKeyStore::AddKey(const CKey& key) } -bool CCryptoKeyStore::AddCryptedKey(const std::vector<unsigned char> &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret) +bool CCryptoKeyStore::AddCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret) { { LOCK(cs_KeyStore); if (!SetCrypted()) return false; - mapCryptedKeys[CBitcoinAddress(vchPubKey)] = make_pair(vchPubKey, vchCryptedSecret); + mapCryptedKeys[vchPubKey.GetID()] = make_pair(vchPubKey, vchCryptedSecret); } return true; } -bool CCryptoKeyStore::GetKey(const CBitcoinAddress &address, CKey& keyOut) const +bool CCryptoKeyStore::GetKey(const CKeyID &address, CKey& keyOut) const { { LOCK(cs_KeyStore); @@ -162,10 +162,10 @@ bool CCryptoKeyStore::GetKey(const CBitcoinAddress &address, CKey& keyOut) const CryptedKeyMap::const_iterator mi = mapCryptedKeys.find(address); if (mi != mapCryptedKeys.end()) { - const std::vector<unsigned char> &vchPubKey = (*mi).second.first; + const CPubKey &vchPubKey = (*mi).second.first; const std::vector<unsigned char> &vchCryptedSecret = (*mi).second.second; CSecret vchSecret; - if (!DecryptSecret(vMasterKey, vchCryptedSecret, Hash(vchPubKey.begin(), vchPubKey.end()), vchSecret)) + if (!DecryptSecret(vMasterKey, vchCryptedSecret, vchPubKey.GetHash(), vchSecret)) return false; if (vchSecret.size() != 32) return false; @@ -177,7 +177,7 @@ bool CCryptoKeyStore::GetKey(const CBitcoinAddress &address, CKey& keyOut) const return false; } -bool CCryptoKeyStore::GetPubKey(const CBitcoinAddress &address, std::vector<unsigned char>& vchPubKeyOut) const +bool CCryptoKeyStore::GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const { { LOCK(cs_KeyStore); @@ -207,10 +207,10 @@ bool CCryptoKeyStore::EncryptKeys(CKeyingMaterial& vMasterKeyIn) CKey key; if (!key.SetSecret(mKey.second.first, mKey.second.second)) return false; - const std::vector<unsigned char> vchPubKey = key.GetPubKey(); + const CPubKey vchPubKey = key.GetPubKey(); std::vector<unsigned char> vchCryptedSecret; bool fCompressed; - if (!EncryptSecret(vMasterKeyIn, key.GetSecret(fCompressed), Hash(vchPubKey.begin(), vchPubKey.end()), vchCryptedSecret)) + if (!EncryptSecret(vMasterKeyIn, key.GetSecret(fCompressed), vchPubKey.GetHash(), vchCryptedSecret)) return false; if (!AddCryptedKey(vchPubKey, vchCryptedSecret)) return false; diff --git a/src/keystore.h b/src/keystore.h index 479d6c5a2e..ab369bbf47 100644 --- a/src/keystore.h +++ b/src/keystore.h @@ -7,7 +7,6 @@ #include "crypter.h" #include "sync.h" -#include "base58.h" #include <boost/signals2/signal.hpp> class CScript; @@ -25,17 +24,17 @@ public: virtual bool AddKey(const CKey& key) =0; // Check whether a key corresponding to a given address is present in the store. - virtual bool HaveKey(const CBitcoinAddress &address) const =0; - virtual bool GetKey(const CBitcoinAddress &address, CKey& keyOut) const =0; - virtual void GetKeys(std::set<CBitcoinAddress> &setAddress) const =0; - virtual bool GetPubKey(const CBitcoinAddress &address, std::vector<unsigned char>& vchPubKeyOut) const; + virtual bool HaveKey(const CKeyID &address) const =0; + virtual bool GetKey(const CKeyID &address, CKey& keyOut) const =0; + virtual void GetKeys(std::set<CKeyID> &setAddress) const =0; + virtual bool GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const; // Support for BIP 0013 : see https://en.bitcoin.it/wiki/BIP_0013 virtual bool AddCScript(const CScript& redeemScript) =0; - virtual bool HaveCScript(const uint160 &hash) const =0; - virtual bool GetCScript(const uint160 &hash, CScript& redeemScriptOut) const =0; + virtual bool HaveCScript(const CScriptID &hash) const =0; + virtual bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const =0; - virtual bool GetSecret(const CBitcoinAddress &address, CSecret& vchSecret, bool &fCompressed) const + virtual bool GetSecret(const CKeyID &address, CSecret& vchSecret, bool &fCompressed) const { CKey key; if (!GetKey(address, key)) @@ -45,8 +44,8 @@ public: } }; -typedef std::map<CBitcoinAddress, std::pair<CSecret, bool> > KeyMap; -typedef std::map<uint160, CScript > ScriptMap; +typedef std::map<CKeyID, std::pair<CSecret, bool> > KeyMap; +typedef std::map<CScriptID, CScript > ScriptMap; /** Basic key store, that keeps keys in an address->secret map */ class CBasicKeyStore : public CKeyStore @@ -57,7 +56,7 @@ protected: public: bool AddKey(const CKey& key); - bool HaveKey(const CBitcoinAddress &address) const + bool HaveKey(const CKeyID &address) const { bool result; { @@ -66,7 +65,7 @@ public: } return result; } - void GetKeys(std::set<CBitcoinAddress> &setAddress) const + void GetKeys(std::set<CKeyID> &setAddress) const { setAddress.clear(); { @@ -79,7 +78,7 @@ public: } } } - bool GetKey(const CBitcoinAddress &address, CKey &keyOut) const + bool GetKey(const CKeyID &address, CKey &keyOut) const { { LOCK(cs_KeyStore); @@ -94,11 +93,11 @@ public: return false; } virtual bool AddCScript(const CScript& redeemScript); - virtual bool HaveCScript(const uint160 &hash) const; - virtual bool GetCScript(const uint160 &hash, CScript& redeemScriptOut) const; + virtual bool HaveCScript(const CScriptID &hash) const; + virtual bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const; }; -typedef std::map<CBitcoinAddress, std::pair<std::vector<unsigned char>, std::vector<unsigned char> > > CryptedKeyMap; +typedef std::map<CKeyID, std::pair<CPubKey, std::vector<unsigned char> > > CryptedKeyMap; /** Keystore which keeps the private keys encrypted. * It derives from the basic key store, which is used if no encryption is active. @@ -146,9 +145,9 @@ public: bool Lock(); - virtual bool AddCryptedKey(const std::vector<unsigned char> &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret); + virtual bool AddCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret); bool AddKey(const CKey& key); - bool HaveKey(const CBitcoinAddress &address) const + bool HaveKey(const CKeyID &address) const { { LOCK(cs_KeyStore); @@ -158,9 +157,9 @@ public: } return false; } - bool GetKey(const CBitcoinAddress &address, CKey& keyOut) const; - bool GetPubKey(const CBitcoinAddress &address, std::vector<unsigned char>& vchPubKeyOut) const; - void GetKeys(std::set<CBitcoinAddress> &setAddress) const + bool GetKey(const CKeyID &address, CKey& keyOut) const; + bool GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const; + void GetKeys(std::set<CKeyID> &setAddress) const { if (!IsCrypted()) { diff --git a/src/main.cpp b/src/main.cpp index 96718cf181..981de62659 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -865,12 +865,12 @@ unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast, const CBl // Only change once per interval if ((pindexLast->nHeight+1) % nInterval != 0) { - // Special rules for testnet after 15 Feb 2012: - if (fTestNet && pblock->nTime > 1329264000) + // Special difficulty rule for testnet: + if (fTestNet) { // If the new block's timestamp is more than 2* 10 minutes // then allow mining of a min-difficulty block. - if (pblock->nTime - pindexLast->nTime > nTargetSpacing*2) + if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2) return nProofOfWorkLimit; else { @@ -1926,12 +1926,11 @@ bool LoadBlockIndex(bool fAllowNew) { if (fTestNet) { - hashGenesisBlock = uint256("0x00000007199508e34a9ff81e6ec0c477a4cccff2a4767a8eee39c11db367b008"); - bnProofOfWorkLimit = CBigNum(~uint256(0) >> 28); pchMessageStart[0] = 0xfa; pchMessageStart[1] = 0xbf; pchMessageStart[2] = 0xb5; pchMessageStart[3] = 0xda; + hashGenesisBlock = uint256("000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"); } // @@ -1977,8 +1976,7 @@ bool LoadBlockIndex(bool fAllowNew) if (fTestNet) { block.nTime = 1296688602; - block.nBits = 0x1d07fff8; - block.nNonce = 384568319; + block.nNonce = 414098458; } //// debug print @@ -2304,7 +2302,7 @@ unsigned char pchMessageStart[4] = { 0xf9, 0xbe, 0xb4, 0xd9 }; bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) { - static map<CService, vector<unsigned char> > mapReuseKey; + static map<CService, CPubKey> mapReuseKey; RandAddSeedPerfmon(); if (fDebug) printf("received: %s (%d bytes)\n", strCommand.c_str(), vRecv.size()); diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index 75ea2c12c5..e65d3915ec 100644 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -3,6 +3,7 @@ #include "walletmodel.h" #include "wallet.h" +#include "base58.h" #include <QFont> #include <QColor> @@ -58,11 +59,11 @@ public: cachedAddressTable.clear(); { LOCK(wallet->cs_wallet); - BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress, std::string)& item, wallet->mapAddressBook) + BOOST_FOREACH(const PAIRTYPE(CTxDestination, std::string)& item, wallet->mapAddressBook) { const CBitcoinAddress& address = item.first; const std::string& strName = item.second; - bool fMine = wallet->HaveKey(address); + bool fMine = IsMine(*wallet, address.Get()); cachedAddressTable.append(AddressTableEntry(fMine ? AddressTableEntry::Receiving : AddressTableEntry::Sending, QString::fromStdString(strName), QString::fromStdString(address.ToString()))); @@ -220,7 +221,8 @@ bool AddressTableModel::setData(const QModelIndex & index, const QVariant & valu switch(index.column()) { case Label: - wallet->SetAddressBookName(rec->address.toStdString(), value.toString().toStdString()); + wallet->SetAddressBookName(CBitcoinAddress(rec->address.toStdString()).Get(), value.toString().toStdString()); + rec->label = value.toString(); break; case Address: // Refuse to set invalid address, set error status and return false @@ -235,9 +237,9 @@ bool AddressTableModel::setData(const QModelIndex & index, const QVariant & valu { LOCK(wallet->cs_wallet); // Remove old entry - wallet->DelAddressBookName(rec->address.toStdString()); + wallet->DelAddressBookName(CBitcoinAddress(rec->address.toStdString()).Get()); // Add new entry with new address - wallet->SetAddressBookName(value.toString().toStdString(), rec->label.toStdString()); + wallet->SetAddressBookName(CBitcoinAddress(value.toString().toStdString()).Get(), rec->label.toStdString()); } } break; @@ -314,7 +316,7 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con // Check for duplicate addresses { LOCK(wallet->cs_wallet); - if(wallet->mapAddressBook.count(strAddress)) + if(wallet->mapAddressBook.count(CBitcoinAddress(strAddress).Get())) { editStatus = DUPLICATE_ADDRESS; return QString(); @@ -331,13 +333,13 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con editStatus = WALLET_UNLOCK_FAILURE; return QString(); } - std::vector<unsigned char> newKey; + CPubKey newKey; if(!wallet->GetKeyFromPool(newKey, true)) { editStatus = KEY_GENERATION_FAILURE; return QString(); } - strAddress = CBitcoinAddress(newKey).ToString(); + strAddress = CBitcoinAddress(newKey.GetID()).ToString(); } else { @@ -346,7 +348,7 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con // Add entry { LOCK(wallet->cs_wallet); - wallet->SetAddressBookName(strAddress, strLabel); + wallet->SetAddressBookName(CBitcoinAddress(strAddress).Get(), strLabel); } return QString::fromStdString(strAddress); } @@ -363,7 +365,7 @@ bool AddressTableModel::removeRows(int row, int count, const QModelIndex & paren } { LOCK(wallet->cs_wallet); - wallet->DelAddressBookName(rec->address.toStdString()); + wallet->DelAddressBookName(CBitcoinAddress(rec->address.toStdString()).Get()); } return true; } @@ -375,7 +377,7 @@ QString AddressTableModel::labelForAddress(const QString &address) const { LOCK(wallet->cs_wallet); CBitcoinAddress address_parsed(address.toStdString()); - std::map<CBitcoinAddress, std::string>::iterator mi = wallet->mapAddressBook.find(address_parsed); + std::map<CTxDestination, std::string>::iterator mi = wallet->mapAddressBook.find(address_parsed.Get()); if (mi != wallet->mapAddressBook.end()) { return QString::fromStdString(mi->second); diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index bdc6ea6ffd..2a2d200394 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -113,54 +113,6 @@ static void handleRunawayException(std::exception *e) exit(1); } -/** Help message for Bitcoin-Qt, shown with --help. */ -class HelpMessageBox: public QMessageBox -{ - Q_OBJECT -public: - HelpMessageBox(QWidget *parent = 0); - - void exec(); -private: - QString header; - QString coreOptions; - QString uiOptions; -}; - -HelpMessageBox::HelpMessageBox(QWidget *parent): - QMessageBox(parent) -{ - header = tr("Bitcoin-Qt") + " " + tr("version") + " " + - QString::fromStdString(FormatFullVersion()) + "\n\n" + - tr("Usage:") + "\n" + - " bitcoin-qt [" + tr("options") + "] " + "\n"; - coreOptions = QString::fromStdString(HelpMessage()); - uiOptions = tr("UI options") + ":\n" + - " -lang=<lang> " + tr("Set language, for example \"de_DE\" (default: system locale)") + "\n" + - " -min " + tr("Start minimized") + "\n" + - " -splash " + tr("Show splash screen on startup (default: 1)") + "\n"; - - setWindowTitle(tr("Bitcoin-Qt")); - setTextFormat(Qt::PlainText); - // setMinimumWidth is ignored for QMessageBox so put in nonbreaking spaces to make it wider. - QChar em_space(0x2003); - setText(header + QString(em_space).repeated(40)); - setDetailedText(coreOptions + "\n" + uiOptions); -} -#include "bitcoin.moc" - -void HelpMessageBox::exec() -{ -#if defined(WIN32) - // On windows, show a message box, as there is no stderr in windowed applications - QMessageBox::exec(); -#else - // On other operating systems, the expected action is to print the message to the console. - QString strUsage = header + "\n" + coreOptions + "\n" + uiOptions; - fprintf(stderr, "%s", strUsage.toStdString().c_str()); -#endif -} - #ifndef BITCOIN_QT_TEST int main(int argc, char *argv[]) { @@ -259,7 +211,7 @@ int main(int argc, char *argv[]) // but before showing splash screen. if (mapArgs.count("-?") || mapArgs.count("--help")) { - HelpMessageBox help; + GUIUtil::HelpMessageBox help; help.exec(); return 1; } diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index a4bb63886b..546a39f43d 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -849,7 +849,7 @@ void BitcoinGUI::changePassphrase() void BitcoinGUI::verifyMessage() { - VerifyMessageDialog *dlg = new VerifyMessageDialog(walletModel->getAddressTableModel(), this); + VerifyMessageDialog *dlg = new VerifyMessageDialog(this); dlg->setAttribute(Qt::WA_DeleteOnClose); dlg->show(); } diff --git a/src/qt/bitcoinstrings.cpp b/src/qt/bitcoinstrings.cpp index ad17475816..d71b5e1e25 100644 --- a/src/qt/bitcoinstrings.cpp +++ b/src/qt/bitcoinstrings.cpp @@ -5,10 +5,41 @@ #else #define UNUSED #endif -static const char UNUSED *bitcoin_strings[] = {QT_TRANSLATE_NOOP("bitcoin-core", "" -"Unable to bind to %s on this computer. Bitcoin is probably already running."), +static const char UNUSED *bitcoin_strings[] = {QT_TRANSLATE_NOOP("bitcoin-core", "To use the %s option"), +QT_TRANSLATE_NOOP("bitcoin-core", "" +"%s, you must set a rpcpassword in the configuration file:\n" +" %s\n" +"It is recommended you use the following random password:\n" +"rpcuser=bitcoinrpc\n" +"rpcpassword=%s\n" +"(you do not need to remember this password)\n" +"If the file does not exist, create it with owner-readable-only file " +"permissions.\n"), +QT_TRANSLATE_NOOP("bitcoin-core", "Error"), +QT_TRANSLATE_NOOP("bitcoin-core", "An error occured while setting up the RPC port %i for listening: %s"), +QT_TRANSLATE_NOOP("bitcoin-core", "" +"You must set rpcpassword=<password> in the configuration file:\n" +"%s\n" +"If the file does not exist, create it with owner-readable-only file " +"permissions."), +QT_TRANSLATE_NOOP("bitcoin-core", "" +"Warning: Please check that your computer's date and time are correct. If " +"your clock is wrong Bitcoin will not work properly."), +QT_TRANSLATE_NOOP("bitcoin-core", "" +"Unable to bind to %s on this computer. Bitcoin is probably already running."), QT_TRANSLATE_NOOP("bitcoin-core", "Unable to bind to %s on this computer (bind returned error %d, %s)"), -QT_TRANSLATE_NOOP("bitcoin-core", "Warning: Disk space is low "), +QT_TRANSLATE_NOOP("bitcoin-core", "Error: Wallet locked, unable to create transaction "), +QT_TRANSLATE_NOOP("bitcoin-core", "" +"Error: This transaction requires a transaction fee of at least %s because of " +"its amount, complexity, or use of recently received funds "), +QT_TRANSLATE_NOOP("bitcoin-core", "Error: Transaction creation failed "), +QT_TRANSLATE_NOOP("bitcoin-core", "Sending..."), +QT_TRANSLATE_NOOP("bitcoin-core", "" +"Error: The transaction was rejected. This might happen if some of the coins " +"in your wallet were already spent, such as if you used a copy of wallet.dat " +"and coins were spent in the copy but not marked as spent here."), +QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount"), +QT_TRANSLATE_NOOP("bitcoin-core", "Insufficient funds"), QT_TRANSLATE_NOOP("bitcoin-core", "Bitcoin version"), QT_TRANSLATE_NOOP("bitcoin-core", "Usage:"), QT_TRANSLATE_NOOP("bitcoin-core", "Send command to -server or bitcoind"), @@ -83,11 +114,20 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Server private key (default: server.pem)"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:" "@STRENGTH)"), +QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -paytxfee=<amount>: '%s'"), +QT_TRANSLATE_NOOP("bitcoin-core", "" +"Warning: -paytxfee is set very high. This is the transaction fee you will " +"pay if you send a transaction."), QT_TRANSLATE_NOOP("bitcoin-core", "" "Cannot obtain a lock on data directory %s. Bitcoin is probably already " "running."), -QT_TRANSLATE_NOOP("bitcoin-core", "Loading addresses..."), -QT_TRANSLATE_NOOP("bitcoin-core", "Error loading addr.dat"), +QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -proxy address: '%s'"), +QT_TRANSLATE_NOOP("bitcoin-core", "Unknown network specified in -noproxy: '%s'"), +QT_TRANSLATE_NOOP("bitcoin-core", "Unknown -socks proxy version requested: %i"), +QT_TRANSLATE_NOOP("bitcoin-core", "Unknown network specified in -onlynet: '%s'"), +QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -bind address: '%s'"), +QT_TRANSLATE_NOOP("bitcoin-core", "Not listening on any port"), +QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -externalip address: '%s'"), QT_TRANSLATE_NOOP("bitcoin-core", "Loading block index..."), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading blkindex.dat"), QT_TRANSLATE_NOOP("bitcoin-core", "Loading wallet..."), @@ -99,49 +139,8 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Cannot downgrade wallet"), QT_TRANSLATE_NOOP("bitcoin-core", "Cannot initialize keypool"), QT_TRANSLATE_NOOP("bitcoin-core", "Cannot write default address"), QT_TRANSLATE_NOOP("bitcoin-core", "Rescanning..."), -QT_TRANSLATE_NOOP("bitcoin-core", "Done loading"), -QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -proxy address: '%s'"), -QT_TRANSLATE_NOOP("bitcoin-core", "Unknown network specified in -noproxy: '%s'"), -QT_TRANSLATE_NOOP("bitcoin-core", "Unknown network specified in -onlynet: '%s'"), -QT_TRANSLATE_NOOP("bitcoin-core", "Unknown -socks proxy version requested: %i"), -QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -bind address: '%s'"), -QT_TRANSLATE_NOOP("bitcoin-core", "Not listening on any port"), -QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -externalip address: '%s'"), -QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -paytxfee=<amount>: '%s'"), -QT_TRANSLATE_NOOP("bitcoin-core", "" -"Warning: -paytxfee is set very high. This is the transaction fee you will " -"pay if you send a transaction."), +QT_TRANSLATE_NOOP("bitcoin-core", "Loading addresses..."), QT_TRANSLATE_NOOP("bitcoin-core", "Error: could not start node"), -QT_TRANSLATE_NOOP("bitcoin-core", "To use the %s option"), -QT_TRANSLATE_NOOP("bitcoin-core", "" -"%s, you must set a rpcpassword in the configuration file:\n" -" %s\n" -"It is recommended you use the following random password:\n" -"rpcuser=bitcoinrpc\n" -"rpcpassword=%s\n" -"(you do not need to remember this password)\n" -"If the file does not exist, create it with owner-readable-only file " -"permissions.\n"), -QT_TRANSLATE_NOOP("bitcoin-core", "Error"), -QT_TRANSLATE_NOOP("bitcoin-core", "An error occured while setting up the RPC port %i for listening: %s"), -QT_TRANSLATE_NOOP("bitcoin-core", "" -"You must set rpcpassword=<password> in the configuration file:\n" -"%s\n" -"If the file does not exist, create it with owner-readable-only file " -"permissions."), -QT_TRANSLATE_NOOP("bitcoin-core", "" -"Warning: Please check that your computer's date and time are correct. If " -"your clock is wrong Bitcoin will not work properly."), -QT_TRANSLATE_NOOP("bitcoin-core", "Error: Wallet locked, unable to create transaction "), -QT_TRANSLATE_NOOP("bitcoin-core", "" -"Error: This transaction requires a transaction fee of at least %s because of " -"its amount, complexity, or use of recently received funds "), -QT_TRANSLATE_NOOP("bitcoin-core", "Error: Transaction creation failed "), -QT_TRANSLATE_NOOP("bitcoin-core", "Sending..."), -QT_TRANSLATE_NOOP("bitcoin-core", "" -"Error: The transaction was rejected. This might happen if some of the coins " -"in your wallet were already spent, such as if you used a copy of wallet.dat " -"and coins were spent in the copy but not marked as spent here."), -QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount"), -QT_TRANSLATE_NOOP("bitcoin-core", "Insufficient funds"), +QT_TRANSLATE_NOOP("bitcoin-core", "Done loading"), +QT_TRANSLATE_NOOP("bitcoin-core", "Warning: Disk space is low"), };
\ No newline at end of file diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 64fd2a9450..cabbd5d240 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -130,9 +130,9 @@ QString ClientModel::clientName() const return QString::fromStdString(CLIENT_NAME); } -QDateTime ClientModel::formatClientStartupTime() const +QString ClientModel::formatClientStartupTime() const { - return QDateTime::fromTime_t(nClientStartupTime); + return QDateTime::fromTime_t(nClientStartupTime).toString(); } // Handlers for core signals diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 0349c389c5..70d816ba9d 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -41,7 +41,7 @@ public: QString formatFullVersion() const; QString formatBuildDate() const; QString clientName() const; - QDateTime formatClientStartupTime() const; + QString formatClientStartupTime() const; private: OptionsModel *optionsModel; diff --git a/src/qt/forms/rpcconsole.ui b/src/qt/forms/rpcconsole.ui index cded274792..678afad0d4 100644 --- a/src/qt/forms/rpcconsole.ui +++ b/src/qt/forms/rpcconsole.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>706</width> - <height>446</height> + <width>740</width> + <height>450</height> </rect> </property> <property name="windowTitle"> @@ -304,6 +304,29 @@ </widget> </item> <item row="15" column="0"> + <widget class="QLabel" name="labelCLOptions"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Command-line options</string> + </property> + </widget> + </item> + <item row="16" column="0"> + <widget class="QPushButton" name="showCLOptionsButton"> + <property name="toolTip"> + <string>Show the Bitcoin-Qt help message to get a list with possible Bitcoin command-line options.</string> + </property> + <property name="text"> + <string>&Show</string> + </property> + </widget> + </item> + <item row="17" column="0"> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> diff --git a/src/qt/forms/verifymessagedialog.ui b/src/qt/forms/verifymessagedialog.ui index a7c99716e4..afe98b05ab 100644 --- a/src/qt/forms/verifymessagedialog.ui +++ b/src/qt/forms/verifymessagedialog.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>494</width> - <height>342</height> + <width>650</width> + <height>380</height> </rect> </property> <property name="windowTitle"> @@ -17,7 +17,7 @@ <item> <widget class="QLabel" name="label"> <property name="text"> - <string>Enter the message and signature below (be careful to correctly copy newlines, spaces, tabs and other invisible characters) to obtain the Bitcoin address used to sign the message.</string> + <string>Enter the signing address, signature and message below (be careful to correctly copy newlines, spaces, tabs and other invisible characters) to verify the message.</string> </property> <property name="alignment"> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> @@ -28,38 +28,28 @@ </widget> </item> <item> - <widget class="QPlainTextEdit" name="edMessage"/> - </item> - <item> - <widget class="QLineEdit" name="lnSig"> + <widget class="QValidatedLineEdit" name="lnAddress"> <property name="text"> <string/> </property> </widget> </item> <item> - <widget class="QLineEdit" name="lnAddress"> + <widget class="QValidatedLineEdit" name="lnSig"> <property name="text"> <string/> </property> - <property name="readOnly"> - <bool>true</bool> - </property> </widget> </item> <item> - <widget class="QLabel" name="lblStatus"> - <property name="text"> - <string/> - </property> - </widget> + <widget class="QPlainTextEdit" name="edMessage"/> </item> <item> <layout class="QHBoxLayout" name="horizontalLayout"> <item> <widget class="QPushButton" name="verifyMessage"> <property name="toolTip"> - <string>Verify a message and obtain the Bitcoin address used to sign the message</string> + <string>Verify a message to ensure it was signed with the specified Bitcoin address</string> </property> <property name="text"> <string>&Verify Message</string> @@ -71,33 +61,51 @@ </widget> </item> <item> - <widget class="QPushButton" name="copyToClipboard"> - <property name="enabled"> - <bool>false</bool> - </property> + <widget class="QPushButton" name="clearButton"> <property name="toolTip"> - <string>Copy the currently selected address to the system clipboard</string> + <string>Reset all verify message fields</string> </property> <property name="text"> - <string>&Copy Address</string> + <string>Clear &All</string> </property> <property name="icon"> <iconset resource="../bitcoin.qrc"> - <normaloff>:/icons/editcopy</normaloff>:/icons/editcopy</iconset> + <normaloff>:/icons/remove</normaloff>:/icons/remove</iconset> </property> </widget> </item> <item> - <widget class="QPushButton" name="clearButton"> - <property name="toolTip"> - <string>Reset all verify message fields</string> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="lblStatus"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>48</height> + </size> + </property> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> </property> <property name="text"> - <string>Clear &All</string> + <string/> </property> - <property name="icon"> - <iconset resource="../bitcoin.qrc"> - <normaloff>:/icons/remove</normaloff>:/icons/remove</iconset> + <property name="wordWrap"> + <bool>true</bool> </property> </widget> </item> @@ -118,6 +126,13 @@ </item> </layout> </widget> + <customwidgets> + <customwidget> + <class>QValidatedLineEdit</class> + <extends>QLineEdit</extends> + <header>qvalidatedlineedit.h</header> + </customwidget> + </customwidgets> <resources> <include location="../bitcoin.qrc"/> </resources> diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 22c0bfeebe..3f2fc2ffa1 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -3,6 +3,7 @@ #include "walletmodel.h" #include "bitcoinunits.h" #include "util.h" +#include "init.h" #include <QString> #include <QDateTime> @@ -413,5 +414,39 @@ bool SetStartOnSystemStartup(bool fAutoStart) { return false; } #endif +HelpMessageBox::HelpMessageBox(QWidget *parent) : + QMessageBox(parent) +{ + header = tr("Bitcoin-Qt") + " " + tr("version") + " " + + QString::fromStdString(FormatFullVersion()) + "\n\n" + + tr("Usage:") + "\n" + + " bitcoin-qt [" + tr("command-line options") + "] " + "\n"; + + coreOptions = QString::fromStdString(HelpMessage()); + + uiOptions = tr("UI options") + ":\n" + + " -lang=<lang> " + tr("Set language, for example \"de_DE\" (default: system locale)") + "\n" + + " -min " + tr("Start minimized") + "\n" + + " -splash " + tr("Show splash screen on startup (default: 1)") + "\n"; + + setWindowTitle(tr("Bitcoin-Qt")); + setTextFormat(Qt::PlainText); + // setMinimumWidth is ignored for QMessageBox so put in nonbreaking spaces to make it wider. + setText(header + QString(QChar(0x2003)).repeated(50)); + setDetailedText(coreOptions + "\n" + uiOptions); +} + +void HelpMessageBox::exec() +{ +#if defined(WIN32) + // On windows, show a message box, as there is no stderr in windowed applications + QMessageBox::exec(); +#else + // On other operating systems, the expected action is to print the message to the console. + QString strUsage = header + "\n" + coreOptions + "\n" + uiOptions; + fprintf(stderr, "%s", strUsage.toStdString().c_str()); +#endif +} + } // namespace GUIUtil diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index c5f9aae511..ca06348519 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -3,6 +3,7 @@ #include <QString> #include <QObject> +#include <QMessageBox> QT_BEGIN_NAMESPACE class QFont; @@ -80,6 +81,7 @@ namespace GUIUtil class ToolTipToRichTextFilter : public QObject { Q_OBJECT + public: explicit ToolTipToRichTextFilter(int size_threshold, QObject *parent = 0); @@ -93,6 +95,22 @@ namespace GUIUtil bool GetStartOnSystemStartup(); bool SetStartOnSystemStartup(bool fAutoStart); + /** Help message for Bitcoin-Qt, shown with --help. */ + class HelpMessageBox : public QMessageBox + { + Q_OBJECT + + public: + HelpMessageBox(QWidget *parent = 0); + + void exec(); + + private: + QString header; + QString coreOptions; + QString uiOptions; + }; + } // namespace GUIUtil #endif // GUIUTIL_H diff --git a/src/qt/locale/bitcoin_en.ts b/src/qt/locale/bitcoin_en.ts index 5628db1229..f59f0f8abf 100644 --- a/src/qt/locale/bitcoin_en.ts +++ b/src/qt/locale/bitcoin_en.ts @@ -99,22 +99,22 @@ This product includes software developed by the OpenSSL Project for use in the O <translation type="unfinished"></translation> </message> <message> - <location filename="../addressbookpage.cpp" line="297"/> + <location filename="../addressbookpage.cpp" line="292"/> <source>Export Address Book Data</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../addressbookpage.cpp" line="298"/> + <location filename="../addressbookpage.cpp" line="293"/> <source>Comma separated file (*.csv)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../addressbookpage.cpp" line="311"/> + <location filename="../addressbookpage.cpp" line="306"/> <source>Error exporting</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../addressbookpage.cpp" line="311"/> + <location filename="../addressbookpage.cpp" line="306"/> <source>Could not write to file %1.</source> <translation type="unfinished"></translation> </message> @@ -122,17 +122,17 @@ This product includes software developed by the OpenSSL Project for use in the O <context> <name>AddressTableModel</name> <message> - <location filename="../addresstablemodel.cpp" line="78"/> + <location filename="../addresstablemodel.cpp" line="142"/> <source>Label</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../addresstablemodel.cpp" line="78"/> + <location filename="../addresstablemodel.cpp" line="142"/> <source>Address</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../addresstablemodel.cpp" line="114"/> + <location filename="../addresstablemodel.cpp" line="178"/> <source>(no label)</source> <translation type="unfinished"></translation> </message> @@ -287,7 +287,7 @@ Are you sure you wish to encrypt your wallet?</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoingui.cpp" line="517"/> + <location filename="../bitcoingui.cpp" line="515"/> <source>Synchronizing with network...</source> <translation type="unfinished"></translation> </message> @@ -337,11 +337,6 @@ Are you sure you wish to encrypt your wallet?</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoingui.cpp" line="210"/> - <source>Send coins to a bitcoin address</source> - <translation type="unfinished"></translation> - </message> - <message> <location filename="../bitcoingui.cpp" line="216"/> <source>Prove you control an address</source> <translation type="unfinished"></translation> @@ -382,11 +377,6 @@ Are you sure you wish to encrypt your wallet?</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoingui.cpp" line="246"/> - <source>Modify configuration options for bitcoin</source> - <translation type="unfinished"></translation> - </message> - <message> <location filename="../bitcoingui.cpp" line="252"/> <source>&Encrypt Wallet...</source> <translation type="unfinished"></translation> @@ -402,7 +392,7 @@ Are you sure you wish to encrypt your wallet?</source> <translation type="unfinished"></translation> </message> <message numerus="yes"> - <location filename="../bitcoingui.cpp" line="519"/> + <location filename="../bitcoingui.cpp" line="517"/> <source>~%n block(s) remaining</source> <translation> <numerusform>~%n block remaining</numerusform> @@ -410,7 +400,7 @@ Are you sure you wish to encrypt your wallet?</source> </translation> </message> <message> - <location filename="../bitcoingui.cpp" line="530"/> + <location filename="../bitcoingui.cpp" line="528"/> <source>Downloaded %1 of %2 blocks of transaction history (%3% done).</source> <translation type="unfinished"></translation> </message> @@ -420,6 +410,16 @@ Are you sure you wish to encrypt your wallet?</source> <translation type="unfinished"></translation> </message> <message> + <location filename="../bitcoingui.cpp" line="210"/> + <source>Send coins to a Bitcoin address</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../bitcoingui.cpp" line="246"/> + <source>Modify configuration options for Bitcoin</source> + <translation type="unfinished"></translation> + </message> + <message> <location filename="../bitcoingui.cpp" line="249"/> <source>Show or hide the Bitcoin window</source> <translation type="unfinished"></translation> @@ -501,13 +501,8 @@ Are you sure you wish to encrypt your wallet?</source> <source>Bitcoin client</source> <translation type="unfinished"></translation> </message> - <message> - <location filename="../bitcoingui.cpp" line="429"/> - <source>bitcoin-qt</source> - <translation type="unfinished"></translation> - </message> <message numerus="yes"> - <location filename="../bitcoingui.cpp" line="493"/> + <location filename="../bitcoingui.cpp" line="492"/> <source>%n active connection(s) to Bitcoin network</source> <translation> <numerusform>%n active connection to Bitcoin network</numerusform> @@ -515,12 +510,12 @@ Are you sure you wish to encrypt your wallet?</source> </translation> </message> <message> - <location filename="../bitcoingui.cpp" line="542"/> + <location filename="../bitcoingui.cpp" line="540"/> <source>Downloaded %1 blocks of transaction history.</source> <translation type="unfinished"></translation> </message> <message numerus="yes"> - <location filename="../bitcoingui.cpp" line="557"/> + <location filename="../bitcoingui.cpp" line="555"/> <source>%n second(s) ago</source> <translation> <numerusform>%n second ago</numerusform> @@ -528,7 +523,7 @@ Are you sure you wish to encrypt your wallet?</source> </translation> </message> <message numerus="yes"> - <location filename="../bitcoingui.cpp" line="561"/> + <location filename="../bitcoingui.cpp" line="559"/> <source>%n minute(s) ago</source> <translation> <numerusform>%n minute ago</numerusform> @@ -536,7 +531,7 @@ Are you sure you wish to encrypt your wallet?</source> </translation> </message> <message numerus="yes"> - <location filename="../bitcoingui.cpp" line="565"/> + <location filename="../bitcoingui.cpp" line="563"/> <source>%n hour(s) ago</source> <translation> <numerusform>%n hour ago</numerusform> @@ -544,7 +539,7 @@ Are you sure you wish to encrypt your wallet?</source> </translation> </message> <message numerus="yes"> - <location filename="../bitcoingui.cpp" line="569"/> + <location filename="../bitcoingui.cpp" line="567"/> <source>%n day(s) ago</source> <translation> <numerusform>%n day ago</numerusform> @@ -552,7 +547,7 @@ Are you sure you wish to encrypt your wallet?</source> </translation> </message> <message> - <location filename="../bitcoingui.cpp" line="575"/> + <location filename="../bitcoingui.cpp" line="573"/> <source>Up to date</source> <translation type="unfinished"></translation> </message> @@ -562,32 +557,32 @@ Are you sure you wish to encrypt your wallet?</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoingui.cpp" line="588"/> + <location filename="../bitcoingui.cpp" line="590"/> <source>Last received block was generated %1.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoingui.cpp" line="647"/> + <location filename="../bitcoingui.cpp" line="649"/> <source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoingui.cpp" line="652"/> + <location filename="../bitcoingui.cpp" line="654"/> <source>Confirm transaction fee</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoingui.cpp" line="679"/> + <location filename="../bitcoingui.cpp" line="681"/> <source>Sent transaction</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoingui.cpp" line="680"/> + <location filename="../bitcoingui.cpp" line="682"/> <source>Incoming transaction</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoingui.cpp" line="681"/> + <location filename="../bitcoingui.cpp" line="683"/> <source>Date: %1 Amount: %2 Type: %3 @@ -596,51 +591,54 @@ Address: %4 <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoingui.cpp" line="802"/> + <location filename="../bitcoingui.cpp" line="804"/> <source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoingui.cpp" line="810"/> + <location filename="../bitcoingui.cpp" line="812"/> <source>Wallet is <b>encrypted</b> and currently <b>locked</b></source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoingui.cpp" line="833"/> + <location filename="../bitcoingui.cpp" line="835"/> <source>Backup Wallet</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoingui.cpp" line="833"/> + <location filename="../bitcoingui.cpp" line="835"/> <source>Wallet Data (*.dat)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoingui.cpp" line="836"/> + <location filename="../bitcoingui.cpp" line="838"/> <source>Backup Failed</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoingui.cpp" line="836"/> + <location filename="../bitcoingui.cpp" line="838"/> <source>There was an error trying to save the wallet data to the new location.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoin.cpp" line="128"/> + <location filename="../bitcoin.cpp" line="112"/> <source>A fatal error occured. Bitcoin can no longer continue safely and will quit.</source> <translation type="unfinished"></translation> </message> </context> <context> - <name>DisplayOptionsPage</name> + <name>ClientModel</name> <message> - <location filename="../optionsdialog.cpp" line="246"/> - <source>Display</source> + <location filename="../clientmodel.cpp" line="84"/> + <source>Network Alert</source> <translation type="unfinished"></translation> </message> +</context> +<context> + <name>DisplayOptionsPage</name> <message> - <location filename="../optionsdialog.cpp" line="252"/> - <source>User Interface &Language: </source> + <location filename="../optionsdialog.cpp" line="246"/> + <source>Display</source> <translation type="unfinished"></translation> </message> <message> @@ -654,8 +652,13 @@ Address: %4 <translation type="unfinished"></translation> </message> <message> + <location filename="../optionsdialog.cpp" line="252"/> + <source>User Interface &Language:</source> + <translation type="unfinished"></translation> + </message> + <message> <location filename="../optionsdialog.cpp" line="273"/> - <source>&Unit to show amounts in: </source> + <source>&Unit to show amounts in:</source> <translation type="unfinished"></translation> </message> <message> @@ -738,7 +741,7 @@ Address: %4 </message> <message> <location filename="../editaddressdialog.cpp" line="96"/> - <source>The entered address "%1" is not a valid bitcoin address.</source> + <source>The entered address "%1" is not a valid Bitcoin address.</source> <translation type="unfinished"></translation> </message> <message> @@ -755,38 +758,43 @@ Address: %4 <context> <name>HelpMessageBox</name> <message> - <location filename="../bitcoin.cpp" line="149"/> - <location filename="../bitcoin.cpp" line="159"/> + <location filename="../bitcoin.cpp" line="133"/> + <location filename="../bitcoin.cpp" line="143"/> <source>Bitcoin-Qt</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoin.cpp" line="149"/> + <location filename="../bitcoin.cpp" line="133"/> <source>version</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoin.cpp" line="151"/> + <location filename="../bitcoin.cpp" line="135"/> <source>Usage:</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoin.cpp" line="154"/> + <location filename="../bitcoin.cpp" line="136"/> + <source>options</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../bitcoin.cpp" line="138"/> <source>UI options</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoin.cpp" line="155"/> + <location filename="../bitcoin.cpp" line="139"/> <source>Set language, for example "de_DE" (default: system locale)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoin.cpp" line="156"/> + <location filename="../bitcoin.cpp" line="140"/> <source>Start minimized</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoin.cpp" line="157"/> + <location filename="../bitcoin.cpp" line="141"/> <source>Show splash screen on startup (default: 1)</source> <translation type="unfinished"></translation> </message> @@ -833,7 +841,7 @@ Address: %4 <name>MessagePage</name> <message> <location filename="../forms/messagepage.ui" line="14"/> - <source>Sign Message Dialog</source> + <source>Sign Message</source> <translation type="unfinished"></translation> </message> <message> @@ -892,7 +900,7 @@ Address: %4 <translation type="unfinished"></translation> </message> <message> - <location filename="../messagepage.cpp" line="30"/> + <location filename="../messagepage.cpp" line="31"/> <source>Click "Sign Message" to get signature</source> <translation type="unfinished"></translation> </message> @@ -907,29 +915,35 @@ Address: %4 <translation type="unfinished"></translation> </message> <message> - <location filename="../messagepage.cpp" line="29"/> + <location filename="../messagepage.cpp" line="30"/> <source>Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../messagepage.cpp" line="82"/> - <location filename="../messagepage.cpp" line="97"/> - <location filename="../messagepage.cpp" line="109"/> + <location filename="../messagepage.cpp" line="83"/> + <location filename="../messagepage.cpp" line="90"/> + <location filename="../messagepage.cpp" line="105"/> + <location filename="../messagepage.cpp" line="117"/> <source>Error signing</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../messagepage.cpp" line="82"/> + <location filename="../messagepage.cpp" line="83"/> <source>%1 is not a valid address.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../messagepage.cpp" line="97"/> + <location filename="../messagepage.cpp" line="90"/> + <source>%1 does not refer to a key.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../messagepage.cpp" line="105"/> <source>Private key for %1 is not available.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../messagepage.cpp" line="109"/> + <location filename="../messagepage.cpp" line="117"/> <source>Sign failed</source> <translation type="unfinished"></translation> </message> @@ -963,17 +977,17 @@ Address: %4 </message> <message> <location filename="../optionsdialog.cpp" line="357"/> - <source>Proxy &IP: </source> + <source>Proxy &IP:</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../optionsdialog.cpp" line="363"/> - <source>IP address of the proxy (e.g. 127.0.0.1)</source> + <location filename="../optionsdialog.cpp" line="366"/> + <source>&Port:</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../optionsdialog.cpp" line="366"/> - <source>&Port: </source> + <location filename="../optionsdialog.cpp" line="363"/> + <source>IP address of the proxy (e.g. 127.0.0.1)</source> <translation type="unfinished"></translation> </message> <message> @@ -998,50 +1012,57 @@ Address: %4 <translation type="unfinished"></translation> </message> <message> - <location filename="../forms/overviewpage.ui" line="40"/> - <source>Balance:</source> + <location filename="../forms/overviewpage.ui" line="47"/> + <location filename="../forms/overviewpage.ui" line="204"/> + <source>The displayed information may be out of date. Your wallet automatically synchronizes with the Bitcoin network after a connection is established, but this process has not completed yet.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../forms/overviewpage.ui" line="69"/> - <source>Number of transactions:</source> + <location filename="../forms/overviewpage.ui" line="89"/> + <source>Balance:</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../forms/overviewpage.ui" line="79"/> - <source>0</source> + <location filename="../forms/overviewpage.ui" line="147"/> + <source>Number of transactions:</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../forms/overviewpage.ui" line="86"/> + <location filename="../forms/overviewpage.ui" line="118"/> <source>Unconfirmed:</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../forms/overviewpage.ui" line="122"/> + <location filename="../forms/overviewpage.ui" line="40"/> <source>Wallet</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../forms/overviewpage.ui" line="158"/> + <location filename="../forms/overviewpage.ui" line="197"/> <source><b>Recent transactions</b></source> <translation type="unfinished"></translation> </message> <message> - <location filename="../forms/overviewpage.ui" line="56"/> + <location filename="../forms/overviewpage.ui" line="105"/> <source>Your current balance</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../forms/overviewpage.ui" line="102"/> + <location filename="../forms/overviewpage.ui" line="134"/> <source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../forms/overviewpage.ui" line="76"/> + <location filename="../forms/overviewpage.ui" line="154"/> <source>Total number of transactions in wallet</source> <translation type="unfinished"></translation> </message> + <message> + <location filename="../overviewpage.cpp" line="110"/> + <location filename="../overviewpage.cpp" line="111"/> + <source>out of sync</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>QRCodeDialog</name> @@ -1127,7 +1148,7 @@ Address: %4 <location filename="../forms/rpcconsole.ui" line="214"/> <location filename="../forms/rpcconsole.ui" line="237"/> <location filename="../forms/rpcconsole.ui" line="260"/> - <location filename="../rpcconsole.cpp" line="242"/> + <location filename="../rpcconsole.cpp" line="245"/> <source>N/A</source> <translation type="unfinished"></translation> </message> @@ -1217,8 +1238,18 @@ Address: %4 <translation type="unfinished"></translation> </message> <message> - <location filename="../rpcconsole.cpp" line="210"/> - <source>Welcome to the Bitcoin RPC console.<br>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.<br>Type <b>help</b> for an overview of available commands.</source> + <location filename="../rpcconsole.cpp" line="212"/> + <source>Welcome to the Bitcoin RPC console.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../rpcconsole.cpp" line="213"/> + <source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../rpcconsole.cpp" line="214"/> + <source>Type <b>help</b> for an overview of available commands.</source> <translation type="unfinished"></translation> </message> </context> @@ -1399,140 +1430,140 @@ Address: %4 <context> <name>TransactionDesc</name> <message> - <location filename="../transactiondesc.cpp" line="20"/> + <location filename="../transactiondesc.cpp" line="21"/> <source>Open for %1 blocks</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="22"/> + <location filename="../transactiondesc.cpp" line="23"/> <source>Open until %1</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="28"/> + <location filename="../transactiondesc.cpp" line="29"/> <source>%1/offline?</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="30"/> + <location filename="../transactiondesc.cpp" line="31"/> <source>%1/unconfirmed</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="32"/> + <location filename="../transactiondesc.cpp" line="33"/> <source>%1 confirmations</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="50"/> + <location filename="../transactiondesc.cpp" line="51"/> <source><b>Status:</b> </source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="55"/> + <location filename="../transactiondesc.cpp" line="56"/> <source>, has not been successfully broadcast yet</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="57"/> + <location filename="../transactiondesc.cpp" line="58"/> <source>, broadcast through %1 node</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="59"/> + <location filename="../transactiondesc.cpp" line="60"/> <source>, broadcast through %1 nodes</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="63"/> + <location filename="../transactiondesc.cpp" line="64"/> <source><b>Date:</b> </source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="70"/> + <location filename="../transactiondesc.cpp" line="71"/> <source><b>Source:</b> Generated<br></source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="76"/> - <location filename="../transactiondesc.cpp" line="93"/> + <location filename="../transactiondesc.cpp" line="77"/> + <location filename="../transactiondesc.cpp" line="94"/> <source><b>From:</b> </source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="93"/> + <location filename="../transactiondesc.cpp" line="94"/> <source>unknown</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="94"/> - <location filename="../transactiondesc.cpp" line="117"/> - <location filename="../transactiondesc.cpp" line="176"/> + <location filename="../transactiondesc.cpp" line="95"/> + <location filename="../transactiondesc.cpp" line="118"/> + <location filename="../transactiondesc.cpp" line="178"/> <source><b>To:</b> </source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="97"/> + <location filename="../transactiondesc.cpp" line="98"/> <source> (yours, label: </source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="99"/> + <location filename="../transactiondesc.cpp" line="100"/> <source> (yours)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="134"/> - <location filename="../transactiondesc.cpp" line="148"/> - <location filename="../transactiondesc.cpp" line="193"/> - <location filename="../transactiondesc.cpp" line="210"/> + <location filename="../transactiondesc.cpp" line="136"/> + <location filename="../transactiondesc.cpp" line="150"/> + <location filename="../transactiondesc.cpp" line="195"/> + <location filename="../transactiondesc.cpp" line="212"/> <source><b>Credit:</b> </source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="136"/> + <location filename="../transactiondesc.cpp" line="138"/> <source>(%1 matures in %2 more blocks)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="140"/> + <location filename="../transactiondesc.cpp" line="142"/> <source>(not accepted)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="184"/> - <location filename="../transactiondesc.cpp" line="192"/> - <location filename="../transactiondesc.cpp" line="207"/> + <location filename="../transactiondesc.cpp" line="186"/> + <location filename="../transactiondesc.cpp" line="194"/> + <location filename="../transactiondesc.cpp" line="209"/> <source><b>Debit:</b> </source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="198"/> + <location filename="../transactiondesc.cpp" line="200"/> <source><b>Transaction fee:</b> </source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="214"/> + <location filename="../transactiondesc.cpp" line="216"/> <source><b>Net amount:</b> </source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="220"/> + <location filename="../transactiondesc.cpp" line="222"/> <source>Message:</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="222"/> + <location filename="../transactiondesc.cpp" line="224"/> <source>Comment:</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="224"/> + <location filename="../transactiondesc.cpp" line="226"/> <source>Transaction ID:</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiondesc.cpp" line="227"/> + <location filename="../transactiondesc.cpp" line="229"/> <source>Generated coins must wait 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, it will change to "not accepted" and not be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source> <translation type="unfinished"></translation> </message> @@ -1553,27 +1584,27 @@ Address: %4 <context> <name>TransactionTableModel</name> <message> - <location filename="../transactiontablemodel.cpp" line="214"/> + <location filename="../transactiontablemodel.cpp" line="226"/> <source>Date</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiontablemodel.cpp" line="214"/> + <location filename="../transactiontablemodel.cpp" line="226"/> <source>Type</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiontablemodel.cpp" line="214"/> + <location filename="../transactiontablemodel.cpp" line="226"/> <source>Address</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiontablemodel.cpp" line="214"/> + <location filename="../transactiontablemodel.cpp" line="226"/> <source>Amount</source> <translation type="unfinished"></translation> </message> <message numerus="yes"> - <location filename="../transactiontablemodel.cpp" line="275"/> + <location filename="../transactiontablemodel.cpp" line="281"/> <source>Open for %n block(s)</source> <translation> <numerusform>Open for %n block</numerusform> @@ -1581,27 +1612,27 @@ Address: %4 </translation> </message> <message> - <location filename="../transactiontablemodel.cpp" line="278"/> + <location filename="../transactiontablemodel.cpp" line="284"/> <source>Open until %1</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiontablemodel.cpp" line="281"/> + <location filename="../transactiontablemodel.cpp" line="287"/> <source>Offline (%1 confirmations)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiontablemodel.cpp" line="284"/> + <location filename="../transactiontablemodel.cpp" line="290"/> <source>Unconfirmed (%1 of %2 confirmations)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiontablemodel.cpp" line="287"/> + <location filename="../transactiontablemodel.cpp" line="293"/> <source>Confirmed (%1 confirmations)</source> <translation type="unfinished"></translation> </message> <message numerus="yes"> - <location filename="../transactiontablemodel.cpp" line="295"/> + <location filename="../transactiontablemodel.cpp" line="301"/> <source>Mined balance will be available in %n more blocks</source> <translation> <numerusform>Mined balance will be available in %n more block</numerusform> @@ -1609,67 +1640,67 @@ Address: %4 </translation> </message> <message> - <location filename="../transactiontablemodel.cpp" line="301"/> + <location filename="../transactiontablemodel.cpp" line="307"/> <source>This block was not received by any other nodes and will probably not be accepted!</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiontablemodel.cpp" line="304"/> + <location filename="../transactiontablemodel.cpp" line="310"/> <source>Generated but not accepted</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiontablemodel.cpp" line="347"/> + <location filename="../transactiontablemodel.cpp" line="353"/> <source>Received with</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiontablemodel.cpp" line="349"/> + <location filename="../transactiontablemodel.cpp" line="355"/> <source>Received from</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiontablemodel.cpp" line="352"/> + <location filename="../transactiontablemodel.cpp" line="358"/> <source>Sent to</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiontablemodel.cpp" line="354"/> + <location filename="../transactiontablemodel.cpp" line="360"/> <source>Payment to yourself</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiontablemodel.cpp" line="356"/> + <location filename="../transactiontablemodel.cpp" line="362"/> <source>Mined</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiontablemodel.cpp" line="394"/> + <location filename="../transactiontablemodel.cpp" line="400"/> <source>(n/a)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiontablemodel.cpp" line="593"/> + <location filename="../transactiontablemodel.cpp" line="599"/> <source>Transaction status. Hover over this field to show number of confirmations.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiontablemodel.cpp" line="595"/> + <location filename="../transactiontablemodel.cpp" line="601"/> <source>Date and time that the transaction was received.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiontablemodel.cpp" line="597"/> + <location filename="../transactiontablemodel.cpp" line="603"/> <source>Type of transaction.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiontablemodel.cpp" line="599"/> + <location filename="../transactiontablemodel.cpp" line="605"/> <source>Destination address of transaction.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../transactiontablemodel.cpp" line="601"/> + <location filename="../transactiontablemodel.cpp" line="607"/> <source>Amount removed from or added to balance.</source> <translation type="unfinished"></translation> </message> @@ -1881,38 +1912,38 @@ Address: %4 <translation type="unfinished"></translation> </message> <message> - <location filename="../verifymessagedialog.cpp" line="27"/> + <location filename="../verifymessagedialog.cpp" line="28"/> <source>Enter Bitcoin signature</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../verifymessagedialog.cpp" line="28"/> - <source>Click "Apply" to obtain address</source> + <location filename="../verifymessagedialog.cpp" line="29"/> + <source>Click "Verify Message" to obtain address</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../verifymessagedialog.cpp" line="54"/> - <location filename="../verifymessagedialog.cpp" line="61"/> + <location filename="../verifymessagedialog.cpp" line="55"/> + <location filename="../verifymessagedialog.cpp" line="62"/> <source>Invalid Signature</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../verifymessagedialog.cpp" line="54"/> + <location filename="../verifymessagedialog.cpp" line="55"/> <source>The signature could not be decoded. Please check the signature and try again.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../verifymessagedialog.cpp" line="61"/> + <location filename="../verifymessagedialog.cpp" line="62"/> <source>The signature did not match the message digest. Please check the signature and try again.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../verifymessagedialog.cpp" line="71"/> + <location filename="../verifymessagedialog.cpp" line="72"/> <source>Address not found in address book.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../verifymessagedialog.cpp" line="71"/> + <location filename="../verifymessagedialog.cpp" line="72"/> <source>Address found in address book: %1</source> <translation type="unfinished"></translation> </message> @@ -1920,7 +1951,7 @@ Address: %4 <context> <name>WalletModel</name> <message> - <location filename="../walletmodel.cpp" line="142"/> + <location filename="../walletmodel.cpp" line="158"/> <source>Sending...</source> <translation type="unfinished"></translation> </message> @@ -1956,513 +1987,508 @@ Address: %4 <context> <name>bitcoin-core</name> <message> - <location filename="../bitcoinstrings.cpp" line="12"/> + <location filename="../bitcoinstrings.cpp" line="43"/> <source>Bitcoin version</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="13"/> + <location filename="../bitcoinstrings.cpp" line="44"/> <source>Usage:</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="14"/> + <location filename="../bitcoinstrings.cpp" line="45"/> <source>Send command to -server or bitcoind</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="15"/> + <location filename="../bitcoinstrings.cpp" line="46"/> <source>List commands</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="16"/> + <location filename="../bitcoinstrings.cpp" line="47"/> <source>Get help for a command</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="18"/> + <location filename="../bitcoinstrings.cpp" line="49"/> <source>Options:</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="19"/> + <location filename="../bitcoinstrings.cpp" line="50"/> <source>Specify configuration file (default: bitcoin.conf)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="20"/> + <location filename="../bitcoinstrings.cpp" line="51"/> <source>Specify pid file (default: bitcoind.pid)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="21"/> + <location filename="../bitcoinstrings.cpp" line="52"/> <source>Generate coins</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="22"/> + <location filename="../bitcoinstrings.cpp" line="53"/> <source>Don't generate coins</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="23"/> + <location filename="../bitcoinstrings.cpp" line="54"/> <source>Specify data directory</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="24"/> + <location filename="../bitcoinstrings.cpp" line="55"/> <source>Set database cache size in megabytes (default: 25)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="25"/> + <location filename="../bitcoinstrings.cpp" line="56"/> <source>Set database disk log size in megabytes (default: 100)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="26"/> + <location filename="../bitcoinstrings.cpp" line="57"/> <source>Specify connection timeout (in milliseconds)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="32"/> + <location filename="../bitcoinstrings.cpp" line="63"/> <source>Listen for connections on <port> (default: 8333 or testnet: 18333)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="33"/> + <location filename="../bitcoinstrings.cpp" line="64"/> <source>Maintain at most <n> connections to peers (default: 125)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="35"/> + <location filename="../bitcoinstrings.cpp" line="66"/> <source>Connect only to the specified node</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="36"/> + <location filename="../bitcoinstrings.cpp" line="67"/> <source>Connect to a node to retrieve peer addresses, and disconnect</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="37"/> + <location filename="../bitcoinstrings.cpp" line="68"/> <source>Specify your own public address</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="38"/> + <location filename="../bitcoinstrings.cpp" line="69"/> <source>Only connect to nodes in network <net> (IPv4 or IPv6)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="39"/> + <location filename="../bitcoinstrings.cpp" line="70"/> <source>Try to discover public IP address (default: 1)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="42"/> + <location filename="../bitcoinstrings.cpp" line="73"/> <source>Bind to given address. Use [host]:port notation for IPv6</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="44"/> + <location filename="../bitcoinstrings.cpp" line="75"/> <source>Threshold for disconnecting misbehaving peers (default: 100)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="45"/> + <location filename="../bitcoinstrings.cpp" line="76"/> <source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="48"/> + <location filename="../bitcoinstrings.cpp" line="79"/> <source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 10000)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="49"/> + <location filename="../bitcoinstrings.cpp" line="80"/> <source>Maximum per-connection send buffer, <n>*1000 bytes (default: 10000)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="52"/> + <location filename="../bitcoinstrings.cpp" line="83"/> <source>Detach block and address databases. Increases shutdown time (default: 0)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="55"/> + <location filename="../bitcoinstrings.cpp" line="86"/> <source>Accept command line and JSON-RPC commands</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="56"/> + <location filename="../bitcoinstrings.cpp" line="87"/> <source>Run in the background as a daemon and accept commands</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="57"/> + <location filename="../bitcoinstrings.cpp" line="88"/> <source>Use the test network</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="58"/> + <location filename="../bitcoinstrings.cpp" line="89"/> <source>Output extra debugging information</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="59"/> + <location filename="../bitcoinstrings.cpp" line="90"/> <source>Prepend debug output with timestamp</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="60"/> + <location filename="../bitcoinstrings.cpp" line="91"/> <source>Send trace/debug info to console instead of debug.log file</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="61"/> + <location filename="../bitcoinstrings.cpp" line="92"/> <source>Send trace/debug info to debugger</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="62"/> + <location filename="../bitcoinstrings.cpp" line="93"/> <source>Username for JSON-RPC connections</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="63"/> + <location filename="../bitcoinstrings.cpp" line="94"/> <source>Password for JSON-RPC connections</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="64"/> + <location filename="../bitcoinstrings.cpp" line="95"/> <source>Listen for JSON-RPC connections on <port> (default: 8332)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="65"/> + <location filename="../bitcoinstrings.cpp" line="96"/> <source>Allow JSON-RPC connections from specified IP address</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="66"/> + <location filename="../bitcoinstrings.cpp" line="97"/> <source>Send commands to node running on <ip> (default: 127.0.0.1)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="67"/> + <location filename="../bitcoinstrings.cpp" line="98"/> <source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="70"/> + <location filename="../bitcoinstrings.cpp" line="101"/> <source>Upgrade wallet to latest format</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="71"/> + <location filename="../bitcoinstrings.cpp" line="102"/> <source>Set key pool size to <n> (default: 100)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="72"/> + <location filename="../bitcoinstrings.cpp" line="103"/> <source>Rescan the block chain for missing wallet transactions</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="73"/> + <location filename="../bitcoinstrings.cpp" line="104"/> <source>How many blocks to check at startup (default: 2500, 0 = all)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="74"/> + <location filename="../bitcoinstrings.cpp" line="105"/> <source>How thorough the block verification is (0-6, default: 1)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="75"/> + <location filename="../bitcoinstrings.cpp" line="106"/> <source>Imports blocks from external blk000?.dat file</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="77"/> + <location filename="../bitcoinstrings.cpp" line="108"/> <source> SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="80"/> + <location filename="../bitcoinstrings.cpp" line="111"/> <source>Use OpenSSL (https) for JSON-RPC connections</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="81"/> + <location filename="../bitcoinstrings.cpp" line="112"/> <source>Server certificate file (default: server.cert)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="82"/> + <location filename="../bitcoinstrings.cpp" line="113"/> <source>Server private key (default: server.pem)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="83"/> + <location filename="../bitcoinstrings.cpp" line="114"/> <source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="76"/> - <source>This help message</source> + <location filename="../bitcoinstrings.cpp" line="145"/> + <source>Warning: Disk space is low</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="86"/> - <source>Cannot obtain a lock on data directory %s. Bitcoin is probably already running.</source> + <location filename="../bitcoinstrings.cpp" line="107"/> + <source>This help message</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="17"/> - <source>Bitcoin</source> + <location filename="../bitcoinstrings.cpp" line="121"/> + <source>Cannot obtain a lock on data directory %s. Bitcoin is probably already running.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="8"/> - <source>Unable to bind to %s on this computer. Bitcoin is probably already running.</source> + <location filename="../bitcoinstrings.cpp" line="48"/> + <source>Bitcoin</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="10"/> + <location filename="../bitcoinstrings.cpp" line="30"/> <source>Unable to bind to %s on this computer (bind returned error %d, %s)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="27"/> + <location filename="../bitcoinstrings.cpp" line="58"/> <source>Connect through socks proxy</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="28"/> + <location filename="../bitcoinstrings.cpp" line="59"/> <source>Select the version of socks proxy to use (4 or 5, 5 is default)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="29"/> + <location filename="../bitcoinstrings.cpp" line="60"/> <source>Do not use proxy for connections to network <net> (IPv4 or IPv6)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="30"/> + <location filename="../bitcoinstrings.cpp" line="61"/> <source>Allow DNS lookups for -addnode, -seednode and -connect</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="31"/> + <location filename="../bitcoinstrings.cpp" line="62"/> <source>Pass DNS requests to (SOCKS5) proxy</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="89"/> + <location filename="../bitcoinstrings.cpp" line="142"/> <source>Loading addresses...</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="90"/> - <source>Error loading addr.dat</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../bitcoinstrings.cpp" line="92"/> + <location filename="../bitcoinstrings.cpp" line="132"/> <source>Error loading blkindex.dat</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="94"/> + <location filename="../bitcoinstrings.cpp" line="134"/> <source>Error loading wallet.dat: Wallet corrupted</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="95"/> + <location filename="../bitcoinstrings.cpp" line="135"/> <source>Error loading wallet.dat: Wallet requires newer version of Bitcoin</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="96"/> + <location filename="../bitcoinstrings.cpp" line="136"/> <source>Wallet needed to be rewritten: restart Bitcoin to complete</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="97"/> + <location filename="../bitcoinstrings.cpp" line="137"/> <source>Error loading wallet.dat</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="103"/> + <location filename="../bitcoinstrings.cpp" line="124"/> <source>Invalid -proxy address: '%s'</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="104"/> + <location filename="../bitcoinstrings.cpp" line="125"/> <source>Unknown network specified in -noproxy: '%s'</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="105"/> + <location filename="../bitcoinstrings.cpp" line="127"/> <source>Unknown network specified in -onlynet: '%s'</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="106"/> + <location filename="../bitcoinstrings.cpp" line="126"/> <source>Unknown -socks proxy version requested: %i</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="107"/> + <location filename="../bitcoinstrings.cpp" line="128"/> <source>Cannot resolve -bind address: '%s'</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="108"/> + <location filename="../bitcoinstrings.cpp" line="129"/> <source>Not listening on any port</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="109"/> + <location filename="../bitcoinstrings.cpp" line="130"/> <source>Cannot resolve -externalip address: '%s'</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="110"/> + <location filename="../bitcoinstrings.cpp" line="117"/> <source>Invalid amount for -paytxfee=<amount>: '%s'</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="114"/> + <location filename="../bitcoinstrings.cpp" line="143"/> <source>Error: could not start node</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="135"/> + <location filename="../bitcoinstrings.cpp" line="31"/> <source>Error: Wallet locked, unable to create transaction </source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="136"/> + <location filename="../bitcoinstrings.cpp" line="32"/> <source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds </source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="139"/> + <location filename="../bitcoinstrings.cpp" line="35"/> <source>Error: Transaction creation failed </source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="140"/> + <location filename="../bitcoinstrings.cpp" line="36"/> <source>Sending...</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="141"/> + <location filename="../bitcoinstrings.cpp" line="37"/> <source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="145"/> + <location filename="../bitcoinstrings.cpp" line="41"/> <source>Invalid amount</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="146"/> + <location filename="../bitcoinstrings.cpp" line="42"/> <source>Insufficient funds</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="91"/> + <location filename="../bitcoinstrings.cpp" line="131"/> <source>Loading block index...</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="34"/> + <location filename="../bitcoinstrings.cpp" line="65"/> <source>Add a node to connect to and attempt to keep the connection open</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="40"/> + <location filename="../bitcoinstrings.cpp" line="28"/> + <source>Unable to bind to %s on this computer. Bitcoin is probably already running.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../bitcoinstrings.cpp" line="71"/> <source>Find peers using internet relay chat (default: 0)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="41"/> + <location filename="../bitcoinstrings.cpp" line="72"/> <source>Accept connections from outside (default: 1)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="43"/> + <location filename="../bitcoinstrings.cpp" line="74"/> <source>Find peers using DNS lookup (default: 1)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="50"/> + <location filename="../bitcoinstrings.cpp" line="81"/> <source>Use Universal Plug and Play to map the listening port (default: 1)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="51"/> + <location filename="../bitcoinstrings.cpp" line="82"/> <source>Use Universal Plug and Play to map the listening port (default: 0)</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="54"/> + <location filename="../bitcoinstrings.cpp" line="85"/> <source>Fee per KB to add to transactions you send</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="93"/> + <location filename="../bitcoinstrings.cpp" line="118"/> + <source>Warning: -paytxfee is set very high. This is the transaction fee you will pay if you send a transaction.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../bitcoinstrings.cpp" line="133"/> <source>Loading wallet...</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="98"/> + <location filename="../bitcoinstrings.cpp" line="138"/> <source>Cannot downgrade wallet</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="99"/> + <location filename="../bitcoinstrings.cpp" line="139"/> <source>Cannot initialize keypool</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="100"/> + <location filename="../bitcoinstrings.cpp" line="140"/> <source>Cannot write default address</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="101"/> + <location filename="../bitcoinstrings.cpp" line="141"/> <source>Rescanning...</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="102"/> + <location filename="../bitcoinstrings.cpp" line="144"/> <source>Done loading</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="111"/> - <source>Warning: -paytxfee is set very high. This is the transaction fee you will pay if you send a transaction.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../bitcoinstrings.cpp" line="11"/> - <source>Warning: Disk space is low </source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../bitcoinstrings.cpp" line="115"/> + <location filename="../bitcoinstrings.cpp" line="8"/> <source>To use the %s option</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="116"/> + <location filename="../bitcoinstrings.cpp" line="9"/> <source>%s, you must set a rpcpassword in the configuration file: %s It is recommended you use the following random password: @@ -2474,24 +2500,24 @@ If the file does not exist, create it with owner-readable-only file permissions. <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="125"/> + <location filename="../bitcoinstrings.cpp" line="18"/> <source>Error</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="126"/> + <location filename="../bitcoinstrings.cpp" line="19"/> <source>An error occured while setting up the RPC port %i for listening: %s</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="127"/> + <location filename="../bitcoinstrings.cpp" line="20"/> <source>You must set rpcpassword=<password> in the configuration file: %s If the file does not exist, create it with owner-readable-only file permissions.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../bitcoinstrings.cpp" line="132"/> + <location filename="../bitcoinstrings.cpp" line="25"/> <source>Warning: Please check that your computer's date and time are correct. If your clock is wrong Bitcoin will not work properly.</source> <translation type="unfinished"></translation> </message> diff --git a/src/qt/messagepage.cpp b/src/qt/messagepage.cpp index 1f895e28ff..ab3ea5a0c5 100644 --- a/src/qt/messagepage.cpp +++ b/src/qt/messagepage.cpp @@ -10,6 +10,7 @@ #include "main.h" #include "wallet.h" #include "init.h" +#include "base58.h" #include "messagepage.h" #include "ui_messagepage.h" @@ -83,6 +84,13 @@ void MessagePage::on_signMessage_clicked() QMessageBox::Abort, QMessageBox::Abort); return; } + CKeyID keyID; + if (!addr.GetKeyID(keyID)) + { + QMessageBox::critical(this, tr("Error signing"), tr("%1 does not refer to a key.").arg(address), + QMessageBox::Abort, QMessageBox::Abort); + return; + } WalletModel::UnlockContext ctx(model->requestUnlock()); if(!ctx.isValid()) @@ -92,7 +100,7 @@ void MessagePage::on_signMessage_clicked() } CKey key; - if (!pwalletMain->GetKey(addr, key)) + if (!pwalletMain->GetKey(keyID, key)) { QMessageBox::critical(this, tr("Error signing"), tr("Private key for %1 is not available.").arg(address), QMessageBox::Abort, QMessageBox::Abort); diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 7029ee33bc..f7b06b5b93 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -109,10 +109,13 @@ RPCConsole::RPCConsole(QWidget *parent) : { ui->setupUi(this); -#ifdef WIN32 +#ifndef Q_WS_MAC ui->openDebugLogfileButton->setIcon(QIcon(":/icons/export")); -#else - // Show Debug logfile label and Open button only for Windows + ui->showCLOptionsButton->setIcon(QIcon(":/icons/options")); +#endif + +#ifndef WIN32 + // Hide Debug logfile label and Open button for non Windows-OSes ui->labelDebugLogfile->setVisible(false); ui->openDebugLogfileButton->setVisible(false); #endif @@ -163,7 +166,7 @@ void RPCConsole::setClientModel(ClientModel *model) ui->clientVersion->setText(model->formatFullVersion()); ui->clientName->setText(model->clientName()); ui->buildDate->setText(model->formatBuildDate()); - ui->startupTime->setText(model->formatClientStartupTime().toString()); + ui->startupTime->setText(model->formatClientStartupTime()); setNumConnections(model->getNumConnections()); ui->isTestNet->setChecked(model->isTestNet()); @@ -326,3 +329,9 @@ void RPCConsole::scrollToEnd() QScrollBar *scrollbar = ui->messagesWidget->verticalScrollBar(); scrollbar->setValue(scrollbar->maximum()); } + +void RPCConsole::on_showCLOptionsButton_clicked() +{ + GUIUtil::HelpMessageBox help; + help.exec(); +} diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index 4b71cdb988..3c38b4b8de 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -35,6 +35,8 @@ private slots: void on_tabWidget_currentChanged(int index); /** open the debug.log from the current datadir */ void on_openDebugLogfileButton_clicked(); + /** display messagebox with program parameters (same as bitcoin-qt --help) */ + void on_showCLOptionsButton_clicked(); public slots: void clear(); diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index 286cddf2a9..10bcef0d90 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -7,6 +7,7 @@ #include "wallet.h" #include "db.h" #include "ui_interface.h" +#include "base58.h" #include <QString> @@ -85,14 +86,14 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx) { if (wallet->IsMine(txout)) { - CBitcoinAddress address; - if (ExtractAddress(txout.scriptPubKey, address) && wallet->HaveKey(address)) + CTxDestination address; + if (ExtractDestination(txout.scriptPubKey, address) && IsMine(*wallet, address)) { if (wallet->mapAddressBook.count(address)) { strHTML += tr("<b>From:</b> ") + tr("unknown") + "<br>"; strHTML += tr("<b>To:</b> "); - strHTML += GUIUtil::HtmlEscape(address.ToString()); + strHTML += GUIUtil::HtmlEscape(CBitcoinAddress(address).ToString()); if (!wallet->mapAddressBook[address].empty()) strHTML += tr(" (yours, label: ") + GUIUtil::HtmlEscape(wallet->mapAddressBook[address]) + ")"; else @@ -115,8 +116,9 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx) // Online transaction strAddress = wtx.mapValue["to"]; strHTML += tr("<b>To:</b> "); - if (wallet->mapAddressBook.count(strAddress) && !wallet->mapAddressBook[strAddress].empty()) - strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[strAddress]) + " "; + CTxDestination dest = CBitcoinAddress(strAddress).Get(); + if (wallet->mapAddressBook.count(dest) && !wallet->mapAddressBook[dest].empty()) + strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[dest]) + " "; strHTML += GUIUtil::HtmlEscape(strAddress) + "<br>"; } @@ -170,13 +172,13 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx) if (wtx.mapValue["to"].empty()) { // Offline transaction - CBitcoinAddress address; - if (ExtractAddress(txout.scriptPubKey, address)) + CTxDestination address; + if (ExtractDestination(txout.scriptPubKey, address)) { strHTML += tr("<b>To:</b> "); if (wallet->mapAddressBook.count(address) && !wallet->mapAddressBook[address].empty()) strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[address]) + " "; - strHTML += GUIUtil::HtmlEscape(address.ToString()); + strHTML += GUIUtil::HtmlEscape(CBitcoinAddress(address).ToString()); strHTML += "<br>"; } } @@ -260,12 +262,12 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx) { strHTML += "<li>"; const CTxOut &vout = prev.vout[prevout.n]; - CBitcoinAddress address; - if (ExtractAddress(vout.scriptPubKey, address)) + CTxDestination address; + if (ExtractDestination(vout.scriptPubKey, address)) { if (wallet->mapAddressBook.count(address) && !wallet->mapAddressBook[address].empty()) strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[address]) + " "; - strHTML += QString::fromStdString(address.ToString()); + strHTML += QString::fromStdString(CBitcoinAddress(address).ToString()); } strHTML = strHTML + " Amount=" + BitcoinUnits::formatWithUnit(BitcoinUnits::BTC,vout.nValue); strHTML = strHTML + " IsMine=" + (wallet->IsMine(vout) ? "true" : "false") + "</li>"; diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 017244ffd0..160973638d 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -1,6 +1,7 @@ #include "transactionrecord.h" #include "wallet.h" +#include "base58.h" /* Return positive answer if transaction should be shown in list. */ @@ -50,7 +51,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet * if(wallet->IsMine(txout)) { TransactionRecord sub(hash, nTime); - CBitcoinAddress address; + CTxDestination address; sub.idx = parts.size(); // sequence number sub.credit = txout.nValue; if (wtx.IsCoinBase()) @@ -58,11 +59,11 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet * // Generated sub.type = TransactionRecord::Generated; } - else if (ExtractAddress(txout.scriptPubKey, address) && wallet->HaveKey(address)) + else if (ExtractDestination(txout.scriptPubKey, address) && IsMine(*wallet, address)) { // Received by Bitcoin Address sub.type = TransactionRecord::RecvWithAddress; - sub.address = address.ToString(); + sub.address = CBitcoinAddress(address).ToString(); } else { @@ -113,12 +114,12 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet * continue; } - CBitcoinAddress address; - if (ExtractAddress(txout.scriptPubKey, address)) + CTxDestination address; + if (ExtractDestination(txout.scriptPubKey, address)) { // Sent to Bitcoin Address sub.type = TransactionRecord::SendToAddress; - sub.address = address.ToString(); + sub.address = CBitcoinAddress(address).ToString(); } else { diff --git a/src/qt/verifymessagedialog.cpp b/src/qt/verifymessagedialog.cpp index 0bac24820c..92f58328a4 100644 --- a/src/qt/verifymessagedialog.cpp +++ b/src/qt/verifymessagedialog.cpp @@ -4,34 +4,36 @@ #include <string> #include <vector> -#include <QDialogButtonBox> -#include <QAbstractButton> -#include <QClipboard> -#include <QMessageBox> +#include <QDialog> +#include <QLabel> +#include <QLineEdit> +#include <QPlainTextEdit> +#include <QPushButton> #include "main.h" #include "wallet.h" #include "walletmodel.h" -#include "addresstablemodel.h" #include "guiutil.h" +#include "base58.h" -VerifyMessageDialog::VerifyMessageDialog(AddressTableModel *addressModel, QWidget *parent) : +VerifyMessageDialog::VerifyMessageDialog(QWidget *parent) : QDialog(parent), - ui(new Ui::VerifyMessageDialog), - model(addressModel) + ui(new Ui::VerifyMessageDialog) { ui->setupUi(this); #if (QT_VERSION >= 0x040700) /* Do not move this to the XML file, Qt before 4.7 will choke on it */ + ui->lnAddress->setPlaceholderText(tr("Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)")); ui->lnSig->setPlaceholderText(tr("Enter Bitcoin signature")); - ui->lnAddress->setPlaceholderText(tr("Click \"Verify Message\" to obtain address")); #endif GUIUtil::setupAddressWidget(ui->lnAddress, this); ui->lnAddress->installEventFilter(this); - ui->edMessage->setFocus(); + ui->lnSig->setFont(GUIUtil::bitcoinAddressFont()); + + ui->lnAddress->setFocus(); } VerifyMessageDialog::~VerifyMessageDialog() @@ -39,54 +41,65 @@ VerifyMessageDialog::~VerifyMessageDialog() delete ui; } -bool VerifyMessageDialog::checkAddress() +void VerifyMessageDialog::on_verifyMessage_clicked() { - CDataStream ss(SER_GETHASH, 0); - ss << strMessageMagic; - ss << ui->edMessage->document()->toPlainText().toStdString(); - uint256 hash = Hash(ss.begin(), ss.end()); + CBitcoinAddress addr(ui->lnAddress->text().toStdString()); + if (!addr.IsValid()) + { + ui->lnAddress->setValid(false); + ui->lblStatus->setStyleSheet("QLabel { color: red; }"); + ui->lblStatus->setText(tr("\"%1\" is not a valid address.").arg(ui->lnAddress->text()) + QString(" ") + tr("Please check the address and try again.")); + return; + } + CKeyID keyID; + if (!addr.GetKeyID(keyID)) + { + ui->lnAddress->setValid(false); + ui->lblStatus->setStyleSheet("QLabel { color: red; }"); + ui->lblStatus->setText(tr("\"%1\" does not refer to a key.").arg(ui->lnAddress->text()) + QString(" ") + tr("Please check the address and try again.")); + return; + } - bool invalid = true; - std::vector<unsigned char> vchSig = DecodeBase64(ui->lnSig->text().toStdString().c_str(), &invalid); + bool fInvalid = false; + std::vector<unsigned char> vchSig = DecodeBase64(ui->lnSig->text().toStdString().c_str(), &fInvalid); - if(invalid) + if (fInvalid) { - QMessageBox::warning(this, tr("Invalid Signature"), tr("The signature could not be decoded. Please check the signature and try again.")); - return false; + ui->lnSig->setValid(false); + ui->lblStatus->setStyleSheet("QLabel { color: red; }"); + ui->lblStatus->setText(tr("The signature could not be decoded.") + QString(" ") + tr("Please check the signature and try again.")); + return; } + CDataStream ss(SER_GETHASH, 0); + ss << strMessageMagic; + ss << ui->edMessage->document()->toPlainText().toStdString(); + CKey key; - if(!key.SetCompactSignature(hash, vchSig)) + if (!key.SetCompactSignature(Hash(ss.begin(), ss.end()), vchSig)) { - QMessageBox::warning(this, tr("Invalid Signature"), tr("The signature did not match the message digest. Please check the signature and try again.")); - return false; + ui->lnSig->setValid(false); + ui->lblStatus->setStyleSheet("QLabel { color: red; }"); + ui->lblStatus->setText(tr("The signature did not match the message digest.")+ QString(" ") + tr("Please check the signature and try again.")); + return; } - CBitcoinAddress address(key.GetPubKey()); - QString qStringAddress = QString::fromStdString(address.ToString()); - ui->lnAddress->setText(qStringAddress); - ui->copyToClipboard->setEnabled(true); - - QString label = model->labelForAddress(qStringAddress); - ui->lblStatus->setText(label.isEmpty() ? tr("Address not found in address book.") : tr("Address found in address book: %1").arg(label)); - return true; -} - -void VerifyMessageDialog::on_verifyMessage_clicked() -{ - checkAddress(); -} + if (!(CBitcoinAddress(key.GetPubKey().GetID()) == addr)) + { + ui->lblStatus->setStyleSheet("QLabel { color: red; }"); + ui->lblStatus->setText(QString("<nobr>") + tr("Message verification failed.") + QString("</nobr>")); + return; + } -void VerifyMessageDialog::on_copyToClipboard_clicked() -{ - QApplication::clipboard()->setText(ui->lnAddress->text()); + ui->lblStatus->setStyleSheet("QLabel { color: green; }"); + ui->lblStatus->setText(QString("<nobr>") + tr("Message verified.") + QString("</nobr>")); } void VerifyMessageDialog::on_clearButton_clicked() { - ui->edMessage->clear(); - ui->lnSig->clear(); ui->lnAddress->clear(); + ui->lnSig->clear(); + ui->edMessage->clear(); ui->lblStatus->clear(); ui->edMessage->setFocus(); @@ -94,9 +107,11 @@ void VerifyMessageDialog::on_clearButton_clicked() bool VerifyMessageDialog::eventFilter(QObject *object, QEvent *event) { - if(object == ui->lnAddress && (event->type() == QEvent::MouseButtonPress || + if (object == ui->lnAddress && (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::FocusIn)) { + // set lnAddress to valid, as QEvent::FocusIn would not reach QValidatedLineEdit::focusInEvent + ui->lnAddress->setValid(true); ui->lnAddress->selectAll(); return true; } diff --git a/src/qt/verifymessagedialog.h b/src/qt/verifymessagedialog.h index 9a3fb43415..0bed442d4c 100644 --- a/src/qt/verifymessagedialog.h +++ b/src/qt/verifymessagedialog.h @@ -16,21 +16,17 @@ class VerifyMessageDialog : public QDialog Q_OBJECT public: - explicit VerifyMessageDialog(AddressTableModel *addressModel, QWidget *parent = 0); + explicit VerifyMessageDialog(QWidget *parent); ~VerifyMessageDialog(); protected: bool eventFilter(QObject *object, QEvent *event); private: - bool checkAddress(); - Ui::VerifyMessageDialog *ui; - AddressTableModel *model; private slots: void on_verifyMessage_clicked(); - void on_copyToClipboard_clicked(); void on_clearButton_clicked(); }; diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 807dfc6bf8..9245f774a4 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -7,6 +7,7 @@ #include "ui_interface.h" #include "wallet.h" #include "walletdb.h" // for BackupWallet +#include "base58.h" #include <QSet> @@ -146,7 +147,7 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(const QList<SendCoinsRecipie foreach(const SendCoinsRecipient &rcp, recipients) { CScript scriptPubKey; - scriptPubKey.SetBitcoinAddress(rcp.address.toStdString()); + scriptPubKey.SetDestination(CBitcoinAddress(rcp.address.toStdString()).Get()); vecSend.push_back(make_pair(scriptPubKey, rcp.amount)); } @@ -178,16 +179,17 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(const QList<SendCoinsRecipie foreach(const SendCoinsRecipient &rcp, recipients) { std::string strAddress = rcp.address.toStdString(); + CTxDestination dest = CBitcoinAddress(strAddress).Get(); std::string strLabel = rcp.label.toStdString(); { LOCK(wallet->cs_wallet); - std::map<CBitcoinAddress, std::string>::iterator mi = wallet->mapAddressBook.find(strAddress); + std::map<CTxDestination, std::string>::iterator mi = wallet->mapAddressBook.find(dest); // Check if we have a new address or an updated label if (mi == wallet->mapAddressBook.end() || mi->second != strLabel) { - wallet->SetAddressBookName(strAddress, strLabel); + wallet->SetAddressBookName(dest, strLabel); } } } @@ -277,11 +279,11 @@ static void NotifyKeyStoreStatusChanged(WalletModel *walletmodel, CCryptoKeyStor QMetaObject::invokeMethod(walletmodel, "updateStatus", Qt::QueuedConnection); } -static void NotifyAddressBookChanged(WalletModel *walletmodel, CWallet *wallet, const std::string &address, const std::string &label, bool isMine, ChangeType status) +static void NotifyAddressBookChanged(WalletModel *walletmodel, CWallet *wallet, const CTxDestination &address, const std::string &label, bool isMine, ChangeType status) { - OutputDebugStringF("NotifyAddressBookChanged %s %s isMine=%i status=%i\n", address.c_str(), label.c_str(), isMine, status); + OutputDebugStringF("NotifyAddressBookChanged %s %s isMine=%i status=%i\n", CBitcoinAddress(address).ToString().c_str(), label.c_str(), isMine, status); QMetaObject::invokeMethod(walletmodel, "updateAddressBook", Qt::QueuedConnection, - Q_ARG(QString, QString::fromStdString(address)), + Q_ARG(QString, QString::fromStdString(CBitcoinAddress(address).ToString())), Q_ARG(QString, QString::fromStdString(label)), Q_ARG(bool, isMine), Q_ARG(int, status)); diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp index 4c74e7f30f..30e504a095 100644 --- a/src/rpcdump.cpp +++ b/src/rpcdump.cpp @@ -5,6 +5,7 @@ #include "init.h" // for pwalletMain #include "bitcoinrpc.h" #include "ui_interface.h" +#include "base58.h" #include <boost/lexical_cast.hpp> @@ -51,8 +52,7 @@ Value importprivkey(const Array& params, bool fHelp) bool fCompressed; CSecret secret = vchSecret.GetSecret(fCompressed); key.SetSecret(secret, fCompressed); - CBitcoinAddress vchAddress = CBitcoinAddress(key.GetPubKey()); - + CKeyID vchAddress = key.GetPubKey().GetID(); { LOCK2(cs_main, pwalletMain->cs_wallet); @@ -80,9 +80,12 @@ Value dumpprivkey(const Array& params, bool fHelp) CBitcoinAddress address; if (!address.SetString(strAddress)) throw JSONRPCError(-5, "Invalid Bitcoin address"); + CKeyID keyID; + if (!address.GetKeyID(keyID)) + throw JSONRPCError(-3, "Address does not refer to a key"); CSecret vchSecret; bool fCompressed; - if (!pwalletMain->GetSecret(address, vchSecret, fCompressed)) + if (!pwalletMain->GetSecret(keyID, vchSecret, fCompressed)) throw JSONRPCError(-4,"Private key for address " + strAddress + " is not known"); return CBitcoinSecret(vchSecret, fCompressed).ToString(); } diff --git a/src/script.cpp b/src/script.cpp index 0620fba234..2e1e1ad7de 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -1312,7 +1312,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi } -bool Sign1(const CBitcoinAddress& address, const CKeyStore& keystore, uint256 hash, int nHashType, CScript& scriptSigRet) +bool Sign1(const CKeyID& address, const CKeyStore& keystore, uint256 hash, int nHashType, CScript& scriptSigRet) { CKey key; if (!keystore.GetKey(address, key)) @@ -1334,9 +1334,8 @@ bool SignN(const vector<valtype>& multisigdata, const CKeyStore& keystore, uint2 for (vector<valtype>::const_iterator it = multisigdata.begin()+1; it != multisigdata.begin()+multisigdata.size()-1; it++) { const valtype& pubkey = *it; - CBitcoinAddress address; - address.SetPubKey(pubkey); - if (Sign1(address, keystore, hash, nHashType, scriptSigRet)) + CKeyID keyID = CPubKey(pubkey).GetID(); + if (Sign1(keyID, keystore, hash, nHashType, scriptSigRet)) { ++nSigned; if (nSigned == nRequired) break; @@ -1360,22 +1359,22 @@ bool Solver(const CKeyStore& keystore, const CScript& scriptPubKey, uint256 hash if (!Solver(scriptPubKey, whichTypeRet, vSolutions)) return false; - CBitcoinAddress address; + CKeyID keyID; switch (whichTypeRet) { case TX_NONSTANDARD: return false; case TX_PUBKEY: - address.SetPubKey(vSolutions[0]); - return Sign1(address, keystore, hash, nHashType, scriptSigRet); + keyID = CPubKey(vSolutions[0]).GetID(); + return Sign1(keyID, keystore, hash, nHashType, scriptSigRet); case TX_PUBKEYHASH: - address.SetHash160(uint160(vSolutions[0])); - if (!Sign1(address, keystore, hash, nHashType, scriptSigRet)) + keyID = CKeyID(uint160(vSolutions[0])); + if (!Sign1(keyID, keystore, hash, nHashType, scriptSigRet)) return false; else { - valtype vch; - keystore.GetPubKey(address, vch); + CPubKey vch; + keystore.GetPubKey(keyID, vch); scriptSigRet << vch; } return true; @@ -1436,14 +1435,30 @@ unsigned int HaveKeys(const vector<valtype>& pubkeys, const CKeyStore& keystore) unsigned int nResult = 0; BOOST_FOREACH(const valtype& pubkey, pubkeys) { - CBitcoinAddress address; - address.SetPubKey(pubkey); - if (keystore.HaveKey(address)) + CKeyID keyID = CPubKey(pubkey).GetID(); + if (keystore.HaveKey(keyID)) ++nResult; } return nResult; } + +class CKeyStoreIsMineVisitor : public boost::static_visitor<bool> +{ +private: + const CKeyStore *keystore; +public: + CKeyStoreIsMineVisitor(const CKeyStore *keystoreIn) : keystore(keystoreIn) { } + bool operator()(const CNoDestination &dest) const { return false; } + bool operator()(const CKeyID &keyID) const { return keystore->HaveKey(keyID); } + bool operator()(const CScriptID &scriptID) const { return keystore->HaveCScript(scriptID); } +}; + +bool IsMine(const CKeyStore &keystore, const CTxDestination &dest) +{ + return boost::apply_visitor(CKeyStoreIsMineVisitor(&keystore), dest); +} + bool IsMine(const CKeyStore &keystore, const CScript& scriptPubKey) { vector<valtype> vSolutions; @@ -1451,21 +1466,21 @@ bool IsMine(const CKeyStore &keystore, const CScript& scriptPubKey) if (!Solver(scriptPubKey, whichType, vSolutions)) return false; - CBitcoinAddress address; + CKeyID keyID; switch (whichType) { case TX_NONSTANDARD: return false; case TX_PUBKEY: - address.SetPubKey(vSolutions[0]); - return keystore.HaveKey(address); + keyID = CPubKey(vSolutions[0]).GetID(); + return keystore.HaveKey(keyID); case TX_PUBKEYHASH: - address.SetHash160(uint160(vSolutions[0])); - return keystore.HaveKey(address); + keyID = CKeyID(uint160(vSolutions[0])); + return keystore.HaveKey(keyID); case TX_SCRIPTHASH: { CScript subscript; - if (!keystore.GetCScript(uint160(vSolutions[0]), subscript)) + if (!keystore.GetCScript(CScriptID(uint160(vSolutions[0])), subscript)) return false; return IsMine(keystore, subscript); } @@ -1483,7 +1498,7 @@ bool IsMine(const CKeyStore &keystore, const CScript& scriptPubKey) return false; } -bool ExtractAddress(const CScript& scriptPubKey, CBitcoinAddress& addressRet) +bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet) { vector<valtype> vSolutions; txnouttype whichType; @@ -1492,24 +1507,24 @@ bool ExtractAddress(const CScript& scriptPubKey, CBitcoinAddress& addressRet) if (whichType == TX_PUBKEY) { - addressRet.SetPubKey(vSolutions[0]); + addressRet = CPubKey(vSolutions[0]).GetID(); return true; } else if (whichType == TX_PUBKEYHASH) { - addressRet.SetHash160(uint160(vSolutions[0])); + addressRet = CKeyID(uint160(vSolutions[0])); return true; } else if (whichType == TX_SCRIPTHASH) { - addressRet.SetScriptHash160(uint160(vSolutions[0])); + addressRet = CScriptID(uint160(vSolutions[0])); return true; } // Multisig txns have more than one address... return false; } -bool ExtractAddresses(const CScript& scriptPubKey, txnouttype& typeRet, vector<CBitcoinAddress>& addressRet, int& nRequiredRet) +bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, vector<CTxDestination>& addressRet, int& nRequiredRet) { addressRet.clear(); typeRet = TX_NONSTANDARD; @@ -1522,21 +1537,16 @@ bool ExtractAddresses(const CScript& scriptPubKey, txnouttype& typeRet, vector<C nRequiredRet = vSolutions.front()[0]; for (unsigned int i = 1; i < vSolutions.size()-1; i++) { - CBitcoinAddress address; - address.SetPubKey(vSolutions[i]); + CTxDestination address = CPubKey(vSolutions[i]).GetID(); addressRet.push_back(address); } } else { nRequiredRet = 1; - CBitcoinAddress address; - if (typeRet == TX_PUBKEYHASH) - address.SetHash160(uint160(vSolutions.front())); - else if (typeRet == TX_SCRIPTHASH) - address.SetScriptHash160(uint160(vSolutions.front())); - else if (typeRet == TX_PUBKEY) - address.SetPubKey(vSolutions.front()); + CTxDestination address; + if (!ExtractDestination(scriptPubKey, address)) + return false; addressRet.push_back(address); } @@ -1694,13 +1704,34 @@ bool CScript::IsPayToScriptHash() const this->at(22) == OP_EQUAL); } -void CScript::SetBitcoinAddress(const CBitcoinAddress& address) +class CScriptVisitor : public boost::static_visitor<bool> { - this->clear(); - if (address.IsScript()) - *this << OP_HASH160 << address.GetHash160() << OP_EQUAL; - else - *this << OP_DUP << OP_HASH160 << address.GetHash160() << OP_EQUALVERIFY << OP_CHECKSIG; +private: + CScript *script; +public: + CScriptVisitor(CScript *scriptin) { script = scriptin; } + + bool operator()(const CNoDestination &dest) const { + script->clear(); + return false; + } + + bool operator()(const CKeyID &keyID) const { + script->clear(); + *script << OP_DUP << OP_HASH160 << keyID << OP_EQUALVERIFY << OP_CHECKSIG; + return true; + } + + bool operator()(const CScriptID &scriptID) const { + script->clear(); + *script << OP_HASH160 << scriptID << OP_EQUAL; + return true; + } +}; + +void CScript::SetDestination(const CTxDestination& dest) +{ + boost::apply_visitor(CScriptVisitor(this), dest); } void CScript::SetMultisig(int nRequired, const std::vector<CKey>& keys) @@ -1712,11 +1743,3 @@ void CScript::SetMultisig(int nRequired, const std::vector<CKey>& keys) *this << key.GetPubKey(); *this << EncodeOP_N(keys.size()) << OP_CHECKMULTISIG; } - -void CScript::SetPayToScriptHash(const CScript& subscript) -{ - assert(!subscript.empty()); - uint160 subscriptHash = Hash160(subscript); - this->clear(); - *this << OP_HASH160 << subscriptHash << OP_EQUAL; -} diff --git a/src/script.h b/src/script.h index 5397a1972f..d490cd1824 100644 --- a/src/script.h +++ b/src/script.h @@ -5,15 +5,16 @@ #ifndef H_BITCOIN_SCRIPT #define H_BITCOIN_SCRIPT -#include "base58.h" - #include <string> #include <vector> #include <boost/foreach.hpp> +#include <boost/variant.hpp> + +#include "keystore.h" +#include "bignum.h" class CTransaction; -class CKeyStore; /** Signature hash types/flags */ enum @@ -35,6 +36,20 @@ enum txnouttype TX_MULTISIG, }; +class CNoDestination { +public: + friend bool operator==(const CNoDestination &a, const CNoDestination &b) { return true; } + friend bool operator<(const CNoDestination &a, const CNoDestination &b) { return true; } +}; + +/** A txout script template with a specific destination. It is either: + * * CNoDestination: no destination set + * * CKeyID: TX_PUBKEYHASH destination + * * CScriptID: TX_SCRIPTHASH destination + * A CTxDestination is the internal data type encoded in a CBitcoinAddress + */ +typedef boost::variant<CNoDestination, CKeyID, CScriptID> CTxDestination; + const char* GetTxnOutputType(txnouttype t); /** Script opcodes */ @@ -320,6 +335,12 @@ public: return *this; } + CScript& operator<<(const CPubKey& key) + { + std::vector<unsigned char> vchKey = key.Raw(); + return (*this) << vchKey; + } + CScript& operator<<(const CBigNum& b) { *this << b.getvch(); @@ -515,13 +536,8 @@ public: } - void SetBitcoinAddress(const CBitcoinAddress& address); - void SetBitcoinAddress(const std::vector<unsigned char>& vchPubKey) - { - SetBitcoinAddress(CBitcoinAddress(vchPubKey)); - } + void SetDestination(const CTxDestination& address); void SetMultisig(int nRequired, const std::vector<CKey>& keys); - void SetPayToScriptHash(const CScript& subscript); void PrintHex() const @@ -556,6 +572,11 @@ public: { printf("%s\n", ToString().c_str()); } + + CScriptID GetID() const + { + return CScriptID(Hash160(*this)); + } }; @@ -567,8 +588,9 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<std::v int ScriptSigArgsExpected(txnouttype t, const std::vector<std::vector<unsigned char> >& vSolutions); bool IsStandard(const CScript& scriptPubKey); bool IsMine(const CKeyStore& keystore, const CScript& scriptPubKey); -bool ExtractAddress(const CScript& scriptPubKey, CBitcoinAddress& addressRet); -bool ExtractAddresses(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<CBitcoinAddress>& addressRet, int& nRequiredRet); +bool IsMine(const CKeyStore& keystore, const CTxDestination &dest); +bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet); +bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<CTxDestination>& addressRet, int& nRequiredRet); bool SignSignature(const CKeyStore& keystore, const CTransaction& txFrom, CTransaction& txTo, unsigned int nIn, int nHashType=SIGHASH_ALL); bool VerifySignature(const CTransaction& txFrom, const CTransaction& txTo, unsigned int nIn, bool fValidatePayToScriptHash, int nHashType); diff --git a/src/test/DoS_tests.cpp b/src/test/DoS_tests.cpp index 3a9b2a902c..4a185b3cc5 100644 --- a/src/test/DoS_tests.cpp +++ b/src/test/DoS_tests.cpp @@ -161,7 +161,7 @@ BOOST_AUTO_TEST_CASE(DoS_mapOrphans) tx.vin[0].scriptSig << OP_1; tx.vout.resize(1); tx.vout[0].nValue = 1*CENT; - tx.vout[0].scriptPubKey.SetBitcoinAddress(key.GetPubKey()); + tx.vout[0].scriptPubKey.SetDestination(key.GetPubKey().GetID()); CDataStream ds(SER_DISK, CLIENT_VERSION); ds << tx; @@ -179,7 +179,7 @@ BOOST_AUTO_TEST_CASE(DoS_mapOrphans) tx.vin[0].prevout.hash = txPrev.GetHash(); tx.vout.resize(1); tx.vout[0].nValue = 1*CENT; - tx.vout[0].scriptPubKey.SetBitcoinAddress(key.GetPubKey()); + tx.vout[0].scriptPubKey.SetDestination(key.GetPubKey().GetID()); SignSignature(keystore, txPrev, tx, 0); CDataStream ds(SER_DISK, CLIENT_VERSION); @@ -195,7 +195,7 @@ BOOST_AUTO_TEST_CASE(DoS_mapOrphans) CTransaction tx; tx.vout.resize(1); tx.vout[0].nValue = 1*CENT; - tx.vout[0].scriptPubKey.SetBitcoinAddress(key.GetPubKey()); + tx.vout[0].scriptPubKey.SetDestination(key.GetPubKey().GetID()); tx.vin.resize(500); for (unsigned int j = 0; j < tx.vin.size(); j++) { @@ -244,7 +244,7 @@ BOOST_AUTO_TEST_CASE(DoS_checkSig) tx.vin[0].scriptSig << OP_1; tx.vout.resize(1); tx.vout[0].nValue = 1*CENT; - tx.vout[0].scriptPubKey.SetBitcoinAddress(key.GetPubKey()); + tx.vout[0].scriptPubKey.SetDestination(key.GetPubKey().GetID()); CDataStream ds(SER_DISK, CLIENT_VERSION); ds << tx; @@ -255,7 +255,7 @@ BOOST_AUTO_TEST_CASE(DoS_checkSig) CTransaction tx; tx.vout.resize(1); tx.vout[0].nValue = 1*CENT; - tx.vout[0].scriptPubKey.SetBitcoinAddress(key.GetPubKey()); + tx.vout[0].scriptPubKey.SetDestination(key.GetPubKey().GetID()); tx.vin.resize(NPREV); for (unsigned int j = 0; j < tx.vin.size(); j++) { diff --git a/src/test/base58_tests.cpp b/src/test/base58_tests.cpp index de4096cd39..3f265f1fe3 100644 --- a/src/test/base58_tests.cpp +++ b/src/test/base58_tests.cpp @@ -1,8 +1,6 @@ #include <boost/test/unit_test.hpp> -#include "main.h" -#include "wallet.h" -#include "util.h" +#include "base58.h" BOOST_AUTO_TEST_SUITE(base58_tests) diff --git a/src/test/data/script_invalid.json b/src/test/data/script_invalid.json index f341a12dfd..0c2d7110da 100644 --- a/src/test/data/script_invalid.json +++ b/src/test/data/script_invalid.json @@ -141,6 +141,21 @@ ["NOP", "HASH160"], ["NOP", "HASH256"], +["NOP", +"'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'", +">520 byte push"], +["1", +"0x61616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161", +">201 opcodes executed. 0x61 is NOP"], +["1 2 3 4 5 0x6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f", +"1 2 3 4 5 6 0x6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6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bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' 0x6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f 2DUP 0x616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161", +"10,001-byte scriptPubKey"], ["NOP1","NOP10"] ] diff --git a/src/test/data/script_valid.json b/src/test/data/script_valid.json index 6b527a8b49..6ef4d46a84 100644 --- a/src/test/data/script_valid.json +++ b/src/test/data/script_valid.json @@ -184,5 +184,21 @@ ["0", "IF 0xfd ELSE 1 ENDIF"], ["0", "IF 0xff ELSE 1 ENDIF"], +["NOP", +"'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'", +"520 byte push"], +["1", +"0x616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161", +"201 opcodes executed. 0x61 is NOP"], +["1 2 3 4 5 0x6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f", +"1 2 3 4 5 0x6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f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bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' 0x6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f 2DUP 0x616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161", +"Max-size (10,000-byte), max-push(520 bytes), max-opcodes(201), max stack size(1,000 items). 0x6f is 3DUP, 0x61 is NOP"], + ["NOP","1"] ] diff --git a/src/test/key_tests.cpp b/src/test/key_tests.cpp index a6dab623b0..0a6df88fef 100644 --- a/src/test/key_tests.cpp +++ b/src/test/key_tests.cpp @@ -10,11 +10,18 @@ using namespace std; -static const string strSecret1 ("5HxWvvfubhXpYYpS3tJkw6fq9jE9j18THftkZjHHfmFiWtmAbrj"); -static const string strSecret2 ("5KC4ejrDjv152FGwP386VD1i2NYc5KkfSMyv1nGy1VGDxGHqVY3"); -static const string strSecret1C("Kwr371tjA9u2rFSMZjTNun2PXXP3WPZu2afRHTcta6KxEUdm1vEw"); -static const string strSecret2C("L3Hq7a8FEQwJkW1M2GNKDW28546Vp5miewcCzSqUD9kCAXrJdS3g"); -static const string strAddress1("1HV9Lc3sNHZxwj4Zk6fB38tEmBryq2cBiF"); +static const string strSecret1 ("5HxWvvfubhXpYYpS3tJkw6fq9jE9j18THftkZjHHfmFiWtmAbrj"); +static const string strSecret2 ("5KC4ejrDjv152FGwP386VD1i2NYc5KkfSMyv1nGy1VGDxGHqVY3"); +static const string strSecret1C ("Kwr371tjA9u2rFSMZjTNun2PXXP3WPZu2afRHTcta6KxEUdm1vEw"); +static const string strSecret2C ("L3Hq7a8FEQwJkW1M2GNKDW28546Vp5miewcCzSqUD9kCAXrJdS3g"); +static const CBitcoinAddress addr1 ("1QFqqMUD55ZV3PJEJZtaKCsQmjLT6JkjvJ"); +static const CBitcoinAddress addr2 ("1F5y5E5FMc5YzdJtB9hLaUe43GDxEKXENJ"); +static const CBitcoinAddress addr1C("1NoJrossxPBKfCHuJXT4HadJrXRE9Fxiqs"); +static const CBitcoinAddress addr2C("1CRj2HyM1CXWzHAXLQtiGLyggNT9WQqsDs"); + + +static const string strAddressBad("1HV9Lc3sNHZxwj4Zk6fB38tEmBryq2cBiF"); + #ifdef KEY_TESTS_DUMPINFO void dumpKeyInfo(uint256 privkey) @@ -53,7 +60,7 @@ BOOST_AUTO_TEST_CASE(key_test1) BOOST_CHECK( bsecret2.SetString (strSecret2)); BOOST_CHECK( bsecret1C.SetString(strSecret1C)); BOOST_CHECK( bsecret2C.SetString(strSecret2C)); - BOOST_CHECK(!baddress1.SetString(strAddress1)); + BOOST_CHECK(!baddress1.SetString(strAddressBad)); bool fCompressed; CSecret secret1 = bsecret1.GetSecret (fCompressed); @@ -74,10 +81,10 @@ BOOST_AUTO_TEST_CASE(key_test1) key1C.SetSecret(secret1, true); key2C.SetSecret(secret2, true); - BOOST_CHECK(CBitcoinAddress(key1.GetPubKey ()).ToString() == "1QFqqMUD55ZV3PJEJZtaKCsQmjLT6JkjvJ"); - BOOST_CHECK(CBitcoinAddress(key2.GetPubKey ()).ToString() == "1F5y5E5FMc5YzdJtB9hLaUe43GDxEKXENJ"); - BOOST_CHECK(CBitcoinAddress(key1C.GetPubKey()).ToString() == "1NoJrossxPBKfCHuJXT4HadJrXRE9Fxiqs"); - BOOST_CHECK(CBitcoinAddress(key2C.GetPubKey()).ToString() == "1CRj2HyM1CXWzHAXLQtiGLyggNT9WQqsDs"); + BOOST_CHECK(addr1.Get() == CTxDestination(key1.GetPubKey().GetID())); + BOOST_CHECK(addr2.Get() == CTxDestination(key2.GetPubKey().GetID())); + BOOST_CHECK(addr1C.Get() == CTxDestination(key1C.GetPubKey().GetID())); + BOOST_CHECK(addr2C.Get() == CTxDestination(key2C.GetPubKey().GetID())); for (int n=0; n<16; n++) { diff --git a/src/test/multisig_tests.cpp b/src/test/multisig_tests.cpp index 8ae9290fcc..9cb0efecfd 100644 --- a/src/test/multisig_tests.cpp +++ b/src/test/multisig_tests.cpp @@ -175,12 +175,12 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1) // CBasicKeyStore keystore, emptykeystore, partialkeystore; CKey key[3]; - CBitcoinAddress keyaddr[3]; + CTxDestination keyaddr[3]; for (int i = 0; i < 3; i++) { key[i].MakeNewKey(true); keystore.AddKey(key[i]); - keyaddr[i].SetPubKey(key[i].GetPubKey()); + keyaddr[i] = key[i].GetPubKey().GetID(); } partialkeystore.AddKey(key[0]); @@ -191,8 +191,8 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1) s << key[0].GetPubKey() << OP_CHECKSIG; BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK(solutions.size() == 1); - CBitcoinAddress addr; - BOOST_CHECK(ExtractAddress(s, addr)); + CTxDestination addr; + BOOST_CHECK(ExtractDestination(s, addr)); BOOST_CHECK(addr == keyaddr[0]); BOOST_CHECK(IsMine(keystore, s)); BOOST_CHECK(!IsMine(emptykeystore, s)); @@ -201,11 +201,11 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1) vector<valtype> solutions; txnouttype whichType; CScript s; - s << OP_DUP << OP_HASH160 << Hash160(key[0].GetPubKey()) << OP_EQUALVERIFY << OP_CHECKSIG; + s << OP_DUP << OP_HASH160 << key[0].GetPubKey().GetID() << OP_EQUALVERIFY << OP_CHECKSIG; BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK(solutions.size() == 1); - CBitcoinAddress addr; - BOOST_CHECK(ExtractAddress(s, addr)); + CTxDestination addr; + BOOST_CHECK(ExtractDestination(s, addr)); BOOST_CHECK(addr == keyaddr[0]); BOOST_CHECK(IsMine(keystore, s)); BOOST_CHECK(!IsMine(emptykeystore, s)); @@ -217,8 +217,8 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1) s << OP_2 << key[0].GetPubKey() << key[1].GetPubKey() << OP_2 << OP_CHECKMULTISIG; BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK_EQUAL(solutions.size(), 4); - CBitcoinAddress addr; - BOOST_CHECK(!ExtractAddress(s, addr)); + CTxDestination addr; + BOOST_CHECK(!ExtractDestination(s, addr)); BOOST_CHECK(IsMine(keystore, s)); BOOST_CHECK(!IsMine(emptykeystore, s)); BOOST_CHECK(!IsMine(partialkeystore, s)); @@ -230,9 +230,9 @@ BOOST_AUTO_TEST_CASE(multisig_Solver1) s << OP_1 << key[0].GetPubKey() << key[1].GetPubKey() << OP_2 << OP_CHECKMULTISIG; BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK_EQUAL(solutions.size(), 4); - vector<CBitcoinAddress> addrs; + vector<CTxDestination> addrs; int nRequired; - BOOST_CHECK(ExtractAddresses(s, whichType, addrs, nRequired)); + BOOST_CHECK(ExtractDestinations(s, whichType, addrs, nRequired)); BOOST_CHECK(addrs[0] == keyaddr[0]); BOOST_CHECK(addrs[1] == keyaddr[1]); BOOST_CHECK(nRequired = 1); diff --git a/src/test/script_P2SH_tests.cpp b/src/test/script_P2SH_tests.cpp index aa72c00092..f7bf5dfbf1 100644 --- a/src/test/script_P2SH_tests.cpp +++ b/src/test/script_P2SH_tests.cpp @@ -65,14 +65,14 @@ BOOST_AUTO_TEST_CASE(sign) // different keys, straight/P2SH, pubkey/pubkeyhash CScript standardScripts[4]; standardScripts[0] << key[0].GetPubKey() << OP_CHECKSIG; - standardScripts[1].SetBitcoinAddress(key[1].GetPubKey()); + standardScripts[1].SetDestination(key[1].GetPubKey().GetID()); standardScripts[2] << key[1].GetPubKey() << OP_CHECKSIG; - standardScripts[3].SetBitcoinAddress(key[2].GetPubKey()); + standardScripts[3].SetDestination(key[2].GetPubKey().GetID()); CScript evalScripts[4]; for (int i = 0; i < 4; i++) { keystore.AddCScript(standardScripts[i]); - evalScripts[i].SetPayToScriptHash(standardScripts[i]); + evalScripts[i].SetDestination(standardScripts[i].GetID()); } CTransaction txFrom; // Funding transaction: @@ -122,7 +122,7 @@ BOOST_AUTO_TEST_CASE(norecurse) invalidAsScript << OP_INVALIDOPCODE << OP_INVALIDOPCODE; CScript p2sh; - p2sh.SetPayToScriptHash(invalidAsScript); + p2sh.SetDestination(invalidAsScript.GetID()); CScript scriptSig; scriptSig << Serialize(invalidAsScript); @@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE(norecurse) // Try to recurse, and verification should succeed because // the inner HASH160 <> EQUAL should only check the hash: CScript p2sh2; - p2sh2.SetPayToScriptHash(p2sh); + p2sh2.SetDestination(p2sh.GetID()); CScript scriptSig2; scriptSig2 << Serialize(invalidAsScript) << Serialize(p2sh); @@ -154,7 +154,7 @@ BOOST_AUTO_TEST_CASE(set) } CScript inner[4]; - inner[0].SetBitcoinAddress(key[0].GetPubKey()); + inner[0].SetDestination(key[0].GetPubKey().GetID()); inner[1].SetMultisig(2, std::vector<CKey>(keys.begin(), keys.begin()+2)); inner[2].SetMultisig(1, std::vector<CKey>(keys.begin(), keys.begin()+2)); inner[3].SetMultisig(2, std::vector<CKey>(keys.begin(), keys.begin()+3)); @@ -162,7 +162,7 @@ BOOST_AUTO_TEST_CASE(set) CScript outer[4]; for (int i = 0; i < 4; i++) { - outer[i].SetPayToScriptHash(inner[i]); + outer[i].SetDestination(inner[i].GetID()); keystore.AddCScript(inner[i]); } @@ -232,7 +232,7 @@ BOOST_AUTO_TEST_CASE(switchover) scriptSig << Serialize(notValid); CScript fund; - fund.SetPayToScriptHash(notValid); + fund.SetDestination(notValid.GetID()); // Validation should succeed under old rules (hash is correct): @@ -258,9 +258,9 @@ BOOST_AUTO_TEST_CASE(AreInputsStandard) txFrom.vout.resize(6); // First three are standard: - CScript pay1; pay1.SetBitcoinAddress(key[0].GetPubKey()); + CScript pay1; pay1.SetDestination(key[0].GetPubKey().GetID()); keystore.AddCScript(pay1); - CScript payScriptHash1; payScriptHash1.SetPayToScriptHash(pay1); + CScript payScriptHash1; payScriptHash1.SetDestination(pay1.GetID()); CScript pay1of3; pay1of3.SetMultisig(1, keys); txFrom.vout[0].scriptPubKey = payScriptHash1; @@ -278,13 +278,13 @@ BOOST_AUTO_TEST_CASE(AreInputsStandard) for (int i = 0; i < 11; i++) oneOfEleven << key[0].GetPubKey(); oneOfEleven << OP_11 << OP_CHECKMULTISIG; - txFrom.vout[5].scriptPubKey.SetPayToScriptHash(oneOfEleven); + txFrom.vout[5].scriptPubKey.SetDestination(oneOfEleven.GetID()); mapInputs[txFrom.GetHash()] = make_pair(CTxIndex(), txFrom); CTransaction txTo; txTo.vout.resize(1); - txTo.vout[0].scriptPubKey.SetBitcoinAddress(key[1].GetPubKey()); + txTo.vout[0].scriptPubKey.SetDestination(key[1].GetPubKey().GetID()); txTo.vin.resize(3); txTo.vin[0].prevout.n = 0; @@ -311,7 +311,7 @@ BOOST_AUTO_TEST_CASE(AreInputsStandard) CTransaction txToNonStd; txToNonStd.vout.resize(1); - txToNonStd.vout[0].scriptPubKey.SetBitcoinAddress(key[1].GetPubKey()); + txToNonStd.vout[0].scriptPubKey.SetDestination(key[1].GetPubKey().GetID()); txToNonStd.vin.resize(2); txToNonStd.vin[0].prevout.n = 4; txToNonStd.vin[0].prevout.hash = txFrom.GetHash(); diff --git a/src/test/sigopcount_tests.cpp b/src/test/sigopcount_tests.cpp index d301313a9d..59673f9b3d 100644 --- a/src/test/sigopcount_tests.cpp +++ b/src/test/sigopcount_tests.cpp @@ -32,7 +32,7 @@ BOOST_AUTO_TEST_CASE(GetSigOpCount) BOOST_CHECK_EQUAL(s1.GetSigOpCount(false), 21); CScript p2sh; - p2sh.SetPayToScriptHash(s1); + p2sh.SetDestination(s1.GetID()); CScript scriptSig; scriptSig << OP_0 << Serialize(s1); BOOST_CHECK_EQUAL(p2sh.GetSigOpCount(scriptSig), 3); @@ -49,7 +49,7 @@ BOOST_AUTO_TEST_CASE(GetSigOpCount) BOOST_CHECK_EQUAL(s2.GetSigOpCount(true), 3); BOOST_CHECK_EQUAL(s2.GetSigOpCount(false), 20); - p2sh.SetPayToScriptHash(s2); + p2sh.SetDestination(s2.GetID()); BOOST_CHECK_EQUAL(p2sh.GetSigOpCount(true), 0); BOOST_CHECK_EQUAL(p2sh.GetSigOpCount(false), 0); CScript scriptSig2; diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp index b680ede9a5..be0d976d51 100644 --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -52,9 +52,9 @@ SetupDummyInputs(CBasicKeyStore& keystoreRet, MapPrevTx& inputsRet) dummyTransactions[1].vout.resize(2); dummyTransactions[1].vout[0].nValue = 21*CENT; - dummyTransactions[1].vout[0].scriptPubKey.SetBitcoinAddress(key[2].GetPubKey()); + dummyTransactions[1].vout[0].scriptPubKey.SetDestination(key[2].GetPubKey().GetID()); dummyTransactions[1].vout[1].nValue = 22*CENT; - dummyTransactions[1].vout[1].scriptPubKey.SetBitcoinAddress(key[3].GetPubKey()); + dummyTransactions[1].vout[1].scriptPubKey.SetDestination(key[3].GetPubKey().GetID()); inputsRet[dummyTransactions[1].GetHash()] = make_pair(CTxIndex(), dummyTransactions[1]); return dummyTransactions; diff --git a/src/util.cpp b/src/util.cpp index 3ab30baff6..b07c9c1b7e 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -834,7 +834,7 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific) path = GetDefaultDataDir(); } if (fNetSpecific && GetBoolArg("-testnet", false)) - path /= "testnet"; + path /= "testnet3"; fs::create_directory(path); diff --git a/src/wallet.cpp b/src/wallet.cpp index f4863080ab..4e3b559f6a 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -7,6 +7,7 @@ #include "walletdb.h" #include "crypter.h" #include "ui_interface.h" +#include "base58.h" using namespace std; @@ -16,7 +17,7 @@ using namespace std; // mapWallet // -std::vector<unsigned char> CWallet::GenerateNewKey() +CPubKey CWallet::GenerateNewKey() { bool fCompressed = CanSupportFeature(FEATURE_COMPRPUBKEY); // default to compressed public keys if we want 0.6.0 wallets @@ -44,7 +45,7 @@ bool CWallet::AddKey(const CKey& key) return true; } -bool CWallet::AddCryptedKey(const vector<unsigned char> &vchPubKey, const vector<unsigned char> &vchCryptedSecret) +bool CWallet::AddCryptedKey(const CPubKey &vchPubKey, const vector<unsigned char> &vchCryptedSecret) { if (!CCryptoKeyStore::AddCryptedKey(vchPubKey, vchCryptedSecret)) return false; @@ -361,16 +362,16 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn) #ifndef QT_GUI // If default receiving address gets used, replace it with a new one CScript scriptDefaultKey; - scriptDefaultKey.SetBitcoinAddress(vchDefaultKey); + scriptDefaultKey.SetDestination(vchDefaultKey.GetID()); BOOST_FOREACH(const CTxOut& txout, wtx.vout) { if (txout.scriptPubKey == scriptDefaultKey) { - std::vector<unsigned char> newDefaultKey; + CPubKey newDefaultKey; if (GetKeyFromPool(newDefaultKey, false)) { SetDefaultKey(newDefaultKey); - SetAddressBookName(CBitcoinAddress(vchDefaultKey), ""); + SetAddressBookName(vchDefaultKey.GetID(), ""); } } } @@ -455,7 +456,7 @@ int64 CWallet::GetDebit(const CTxIn &txin) const bool CWallet::IsChange(const CTxOut& txout) const { - CBitcoinAddress address; + CTxDestination address; // TODO: fix handling of 'change' outputs. The assumption is that any // payment to a TX_PUBKEYHASH that is mine but isn't in the address book @@ -464,7 +465,7 @@ bool CWallet::IsChange(const CTxOut& txout) const // a better way of identifying which outputs are 'the send' and which are // 'the change' will need to be implemented (maybe extend CWalletTx to remember // which output, if any, was change). - if (ExtractAddress(txout.scriptPubKey, address) && HaveKey(address)) + if (ExtractDestination(txout.scriptPubKey, address) && ::IsMine(*this, address)) { LOCK(cs_wallet); if (!mapAddressBook.count(address)) @@ -517,8 +518,8 @@ int CWalletTx::GetRequestCount() const return nRequests; } -void CWalletTx::GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, list<pair<CBitcoinAddress, int64> >& listReceived, - list<pair<CBitcoinAddress, int64> >& listSent, int64& nFee, string& strSentAccount) const +void CWalletTx::GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, list<pair<CTxDestination, int64> >& listReceived, + list<pair<CTxDestination, int64> >& listSent, int64& nFee, string& strSentAccount) const { nGeneratedImmature = nGeneratedMature = nFee = 0; listReceived.clear(); @@ -545,13 +546,12 @@ void CWalletTx::GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, l // Sent/received. BOOST_FOREACH(const CTxOut& txout, vout) { - CBitcoinAddress address; + CTxDestination address; vector<unsigned char> vchPubKey; - if (!ExtractAddress(txout.scriptPubKey, address)) + if (!ExtractDestination(txout.scriptPubKey, address)) { printf("CWalletTx::GetAmounts: Unknown transaction type found, txid %s\n", this->GetHash().ToString().c_str()); - address = " unknown "; } // Don't report 'change' txouts @@ -575,25 +575,25 @@ void CWalletTx::GetAccountAmounts(const string& strAccount, int64& nGenerated, i int64 allGeneratedImmature, allGeneratedMature, allFee; allGeneratedImmature = allGeneratedMature = allFee = 0; string strSentAccount; - list<pair<CBitcoinAddress, int64> > listReceived; - list<pair<CBitcoinAddress, int64> > listSent; + list<pair<CTxDestination, int64> > listReceived; + list<pair<CTxDestination, int64> > listSent; GetAmounts(allGeneratedImmature, allGeneratedMature, listReceived, listSent, allFee, strSentAccount); if (strAccount == "") nGenerated = allGeneratedMature; if (strAccount == strSentAccount) { - BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress,int64)& s, listSent) + BOOST_FOREACH(const PAIRTYPE(CTxDestination,int64)& s, listSent) nSent += s.second; nFee = allFee; } { LOCK(pwallet->cs_wallet); - BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress,int64)& r, listReceived) + BOOST_FOREACH(const PAIRTYPE(CTxDestination,int64)& r, listReceived) { if (pwallet->mapAddressBook.count(r.first)) { - map<CBitcoinAddress, string>::const_iterator mi = pwallet->mapAddressBook.find(r.first); + map<CTxDestination, string>::const_iterator mi = pwallet->mapAddressBook.find(r.first); if (mi != pwallet->mapAddressBook.end() && (*mi).second == strAccount) nReceived += r.second; } @@ -1108,14 +1108,14 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64> >& vecSend, CW // post-backup change. // Reserve a new key pair from key pool - vector<unsigned char> vchPubKey = reservekey.GetReservedKey(); + CPubKey vchPubKey = reservekey.GetReservedKey(); // assert(mapKeys.count(vchPubKey)); // Fill a vout to ourself // TODO: pass in scriptChange instead of reservekey so // change transaction isn't always pay-to-bitcoin-address CScript scriptChange; - scriptChange.SetBitcoinAddress(vchPubKey); + scriptChange.SetDestination(vchPubKey.GetID()); // Insert change txn at random position: vector<CTxOut>::iterator position = wtxNew.vout.begin()+GetRandInt(wtxNew.vout.size()); @@ -1253,7 +1253,7 @@ string CWallet::SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, -string CWallet::SendMoneyToBitcoinAddress(const CBitcoinAddress& address, int64 nValue, CWalletTx& wtxNew, bool fAskFee) +string CWallet::SendMoneyToDestination(const CTxDestination& address, int64 nValue, CWalletTx& wtxNew, bool fAskFee) { // Check amount if (nValue <= 0) @@ -1263,7 +1263,7 @@ string CWallet::SendMoneyToBitcoinAddress(const CBitcoinAddress& address, int64 // Parse Bitcoin address CScript scriptPubKey; - scriptPubKey.SetBitcoinAddress(address); + scriptPubKey.SetDestination(address); return SendMoney(scriptPubKey, nValue, wtxNew, fAskFee); } @@ -1291,30 +1291,30 @@ int CWallet::LoadWallet(bool& fFirstRunRet) if (nLoadWalletRet != DB_LOAD_OK) return nLoadWalletRet; - fFirstRunRet = vchDefaultKey.empty(); + fFirstRunRet = !vchDefaultKey.IsValid(); CreateThread(ThreadFlushWalletDB, &strWalletFile); return DB_LOAD_OK; } -bool CWallet::SetAddressBookName(const CBitcoinAddress& address, const string& strName) +bool CWallet::SetAddressBookName(const CTxDestination& address, const string& strName) { - std::map<CBitcoinAddress, std::string>::iterator mi = mapAddressBook.find(address); + std::map<CTxDestination, std::string>::iterator mi = mapAddressBook.find(address); mapAddressBook[address] = strName; - NotifyAddressBookChanged(this, address.ToString(), strName, HaveKey(address), (mi == mapAddressBook.end()) ? CT_NEW : CT_UPDATED); + NotifyAddressBookChanged(this, address, strName, ::IsMine(*this, address), (mi == mapAddressBook.end()) ? CT_NEW : CT_UPDATED); if (!fFileBacked) return false; - return CWalletDB(strWalletFile).WriteName(address.ToString(), strName); + return CWalletDB(strWalletFile).WriteName(CBitcoinAddress(address).ToString(), strName); } -bool CWallet::DelAddressBookName(const CBitcoinAddress& address) +bool CWallet::DelAddressBookName(const CTxDestination& address) { mapAddressBook.erase(address); - NotifyAddressBookChanged(this, address.ToString(), "", HaveKey(address), CT_DELETED); + NotifyAddressBookChanged(this, address, "", ::IsMine(*this, address), CT_DELETED); if (!fFileBacked) return false; - return CWalletDB(strWalletFile).EraseName(address.ToString()); + return CWalletDB(strWalletFile).EraseName(CBitcoinAddress(address).ToString()); } @@ -1345,7 +1345,7 @@ bool CWallet::GetTransaction(const uint256 &hashTx, CWalletTx& wtx) return false; } -bool CWallet::SetDefaultKey(const std::vector<unsigned char> &vchPubKey) +bool CWallet::SetDefaultKey(const CPubKey &vchPubKey) { if (fFileBacked) { @@ -1421,7 +1421,7 @@ bool CWallet::TopUpKeyPool() void CWallet::ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool) { nIndex = -1; - keypool.vchPubKey.clear(); + keypool.vchPubKey = CPubKey(); { LOCK(cs_wallet); @@ -1438,9 +1438,9 @@ void CWallet::ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool) setKeyPool.erase(setKeyPool.begin()); if (!walletdb.ReadPool(nIndex, keypool)) throw runtime_error("ReserveKeyFromKeyPool() : read failed"); - if (!HaveKey(Hash160(keypool.vchPubKey))) + if (!HaveKey(keypool.vchPubKey.GetID())) throw runtime_error("ReserveKeyFromKeyPool() : unknown key in key pool"); - assert(!keypool.vchPubKey.empty()); + assert(keypool.vchPubKey.IsValid()); printf("keypool reserve %"PRI64d"\n", nIndex); } } @@ -1481,7 +1481,7 @@ void CWallet::ReturnKey(int64 nIndex) printf("keypool return %"PRI64d"\n", nIndex); } -bool CWallet::GetKeyFromPool(vector<unsigned char>& result, bool fAllowReuse) +bool CWallet::GetKeyFromPool(CPubKey& result, bool fAllowReuse) { int64 nIndex = 0; CKeyPool keypool; @@ -1490,7 +1490,7 @@ bool CWallet::GetKeyFromPool(vector<unsigned char>& result, bool fAllowReuse) ReserveKeyFromKeyPool(nIndex, keypool); if (nIndex == -1) { - if (fAllowReuse && !vchDefaultKey.empty()) + if (fAllowReuse && vchDefaultKey.IsValid()) { result = vchDefaultKey; return true; @@ -1516,7 +1516,7 @@ int64 CWallet::GetOldestKeyPoolTime() return keypool.nTime; } -vector<unsigned char> CReserveKey::GetReservedKey() +CPubKey CReserveKey::GetReservedKey() { if (nIndex == -1) { @@ -1530,7 +1530,7 @@ vector<unsigned char> CReserveKey::GetReservedKey() vchPubKey = pwallet->vchDefaultKey; } } - assert(!vchPubKey.empty()); + assert(vchPubKey.IsValid()); return vchPubKey; } @@ -1539,7 +1539,7 @@ void CReserveKey::KeepKey() if (nIndex != -1) pwallet->KeepKey(nIndex); nIndex = -1; - vchPubKey.clear(); + vchPubKey = CPubKey(); } void CReserveKey::ReturnKey() @@ -1547,10 +1547,10 @@ void CReserveKey::ReturnKey() if (nIndex != -1) pwallet->ReturnKey(nIndex); nIndex = -1; - vchPubKey.clear(); + vchPubKey = CPubKey(); } -void CWallet::GetAllReserveAddresses(set<CBitcoinAddress>& setAddress) +void CWallet::GetAllReserveKeys(set<CKeyID>& setAddress) { setAddress.clear(); @@ -1562,11 +1562,11 @@ void CWallet::GetAllReserveAddresses(set<CBitcoinAddress>& setAddress) CKeyPool keypool; if (!walletdb.ReadPool(id, keypool)) throw runtime_error("GetAllReserveKeyHashes() : read failed"); - CBitcoinAddress address(keypool.vchPubKey); - assert(!keypool.vchPubKey.empty()); - if (!HaveKey(address)) + assert(keypool.vchPubKey.IsValid()); + CKeyID keyID = keypool.vchPubKey.GetID(); + if (!HaveKey(keyID)) throw runtime_error("GetAllReserveKeyHashes() : unknown key in key pool"); - setAddress.insert(address); + setAddress.insert(keyID); } } diff --git a/src/wallet.h b/src/wallet.h index c29dd738ff..dfdb7b8257 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -32,14 +32,14 @@ class CKeyPool { public: int64 nTime; - std::vector<unsigned char> vchPubKey; + CPubKey vchPubKey; CKeyPool() { nTime = GetTime(); } - CKeyPool(const std::vector<unsigned char>& vchPubKeyIn) + CKeyPool(const CPubKey& vchPubKeyIn) { nTime = GetTime(); vchPubKey = vchPubKeyIn; @@ -105,16 +105,16 @@ public: std::map<uint256, CWalletTx> mapWallet; std::map<uint256, int> mapRequestCount; - std::map<CBitcoinAddress, std::string> mapAddressBook; + std::map<CTxDestination, std::string> mapAddressBook; - std::vector<unsigned char> vchDefaultKey; + CPubKey vchDefaultKey; // check whether we are allowed to upgrade (or already support) to the named feature bool CanSupportFeature(enum WalletFeature wf) { return nWalletMaxVersion >= wf; } // keystore implementation // Generate a new key - std::vector<unsigned char> GenerateNewKey(); + CPubKey GenerateNewKey(); // Adds a key to the store, and saves it to disk. bool AddKey(const CKey& key); // Adds a key to the store, without saving it to disk (used by LoadWallet) @@ -123,9 +123,9 @@ public: bool LoadMinVersion(int nVersion) { nWalletVersion = nVersion; nWalletMaxVersion = std::max(nWalletMaxVersion, nVersion); return true; } // Adds an encrypted key to the store, and saves it to disk. - bool AddCryptedKey(const std::vector<unsigned char> &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret); + bool AddCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret); // Adds an encrypted key to the store, without saving it to disk (used by LoadWallet) - bool LoadCryptedKey(const std::vector<unsigned char> &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret) { SetMinVersion(FEATURE_WALLETCRYPT); return CCryptoKeyStore::AddCryptedKey(vchPubKey, vchCryptedSecret); } + bool LoadCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret) { SetMinVersion(FEATURE_WALLETCRYPT); return CCryptoKeyStore::AddCryptedKey(vchPubKey, vchCryptedSecret); } bool AddCScript(const CScript& redeemScript); bool LoadCScript(const CScript& redeemScript) { return CCryptoKeyStore::AddCScript(redeemScript); } @@ -149,7 +149,7 @@ public: bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CReserveKey& reservekey, int64& nFeeRet); bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey); std::string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false); - std::string SendMoneyToBitcoinAddress(const CBitcoinAddress& address, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false); + std::string SendMoneyToDestination(const CTxDestination &address, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false); bool NewKeyPool(); bool TopUpKeyPool(); @@ -157,9 +157,9 @@ public: void ReserveKeyFromKeyPool(int64& nIndex, CKeyPool& keypool); void KeepKey(int64 nIndex); void ReturnKey(int64 nIndex); - bool GetKeyFromPool(std::vector<unsigned char> &key, bool fAllowReuse=true); + bool GetKeyFromPool(CPubKey &key, bool fAllowReuse=true); int64 GetOldestKeyPoolTime(); - void GetAllReserveAddresses(std::set<CBitcoinAddress>& setAddress); + void GetAllReserveKeys(std::set<CKeyID>& setAddress); bool IsMine(const CTxIn& txin) const; int64 GetDebit(const CTxIn& txin) const; @@ -228,9 +228,9 @@ public: int LoadWallet(bool& fFirstRunRet); - bool SetAddressBookName(const CBitcoinAddress& address, const std::string& strName); + bool SetAddressBookName(const CTxDestination& address, const std::string& strName); - bool DelAddressBookName(const CBitcoinAddress& address); + bool DelAddressBookName(const CTxDestination& address); void UpdatedTransaction(const uint256 &hashTx); @@ -253,7 +253,7 @@ public: bool GetTransaction(const uint256 &hashTx, CWalletTx& wtx); - bool SetDefaultKey(const std::vector<unsigned char> &vchPubKey); + bool SetDefaultKey(const CPubKey &vchPubKey); // signify that a particular wallet feature is now used. this may change nWalletVersion and nWalletMaxVersion if those are lower bool SetMinVersion(enum WalletFeature, CWalletDB* pwalletdbIn = NULL, bool fExplicit = false); @@ -267,7 +267,7 @@ public: /** Address book entry changed. * @note called with lock cs_wallet held. */ - boost::signals2::signal<void (CWallet *wallet, const std::string &address, const std::string &label, bool isMine, ChangeType status)> NotifyAddressBookChanged; + boost::signals2::signal<void (CWallet *wallet, const CTxDestination &address, const std::string &label, bool isMine, ChangeType status)> NotifyAddressBookChanged; /** Wallet transaction added, removed or updated. * @note called with lock cs_wallet held. @@ -281,7 +281,7 @@ class CReserveKey protected: CWallet* pwallet; int64 nIndex; - std::vector<unsigned char> vchPubKey; + CPubKey vchPubKey; public: CReserveKey(CWallet* pwalletIn) { @@ -296,7 +296,7 @@ public: } void ReturnKey(); - std::vector<unsigned char> GetReservedKey(); + CPubKey GetReservedKey(); void KeepKey(); }; @@ -533,8 +533,8 @@ public: return nChangeCached; } - void GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, std::list<std::pair<CBitcoinAddress, int64> >& listReceived, - std::list<std::pair<CBitcoinAddress, int64> >& listSent, int64& nFee, std::string& strSentAccount) const; + void GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, 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, int64& nSent, int64& nFee) const; @@ -641,7 +641,7 @@ public: class CAccount { public: - std::vector<unsigned char> vchPubKey; + CPubKey vchPubKey; CAccount() { @@ -650,7 +650,7 @@ public: void SetNull() { - vchPubKey.clear(); + vchPubKey = CPubKey(); } IMPLEMENT_SERIALIZE diff --git a/src/walletdb.cpp b/src/walletdb.cpp index 2d44e4982f..2c4d4c0ef0 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -104,7 +104,7 @@ void CWalletDB::ListAccountCreditDebit(const string& strAccount, list<CAccountin int CWalletDB::LoadWallet(CWallet* pwallet) { - pwallet->vchDefaultKey.clear(); + pwallet->vchDefaultKey = CPubKey(); int nFileVersion = 0; vector<uint256> vWalletUpgrade; bool fIsEncrypted = false; @@ -151,7 +151,7 @@ int CWalletDB::LoadWallet(CWallet* pwallet) { string strAddress; ssKey >> strAddress; - ssValue >> pwallet->mapAddressBook[strAddress]; + ssValue >> pwallet->mapAddressBook[CBitcoinAddress(strAddress).Get()]; } else if (strType == "tx") { diff --git a/src/walletdb.h b/src/walletdb.h index dee1750262..39182279d5 100644 --- a/src/walletdb.h +++ b/src/walletdb.h @@ -6,6 +6,7 @@ #define BITCOIN_WALLETDB_H #include "db.h" +#include "base58.h" class CKeyPool; class CAccount; @@ -59,27 +60,27 @@ public: return Erase(std::make_pair(std::string("tx"), hash)); } - bool ReadKey(const std::vector<unsigned char>& vchPubKey, CPrivKey& vchPrivKey) + bool ReadKey(const CPubKey& vchPubKey, CPrivKey& vchPrivKey) { vchPrivKey.clear(); - return Read(std::make_pair(std::string("key"), vchPubKey), vchPrivKey); + return Read(std::make_pair(std::string("key"), vchPubKey.Raw()), vchPrivKey); } - bool WriteKey(const std::vector<unsigned char>& vchPubKey, const CPrivKey& vchPrivKey) + bool WriteKey(const CPubKey& vchPubKey, const CPrivKey& vchPrivKey) { nWalletDBUpdated++; - return Write(std::make_pair(std::string("key"), vchPubKey), vchPrivKey, false); + return Write(std::make_pair(std::string("key"), vchPubKey.Raw()), vchPrivKey, false); } - bool WriteCryptedKey(const std::vector<unsigned char>& vchPubKey, const std::vector<unsigned char>& vchCryptedSecret, bool fEraseUnencryptedKey = true) + bool WriteCryptedKey(const CPubKey& vchPubKey, const std::vector<unsigned char>& vchCryptedSecret, bool fEraseUnencryptedKey = true) { nWalletDBUpdated++; - if (!Write(std::make_pair(std::string("ckey"), vchPubKey), vchCryptedSecret, false)) + if (!Write(std::make_pair(std::string("ckey"), vchPubKey.Raw()), vchCryptedSecret, false)) return false; if (fEraseUnencryptedKey) { - Erase(std::make_pair(std::string("key"), vchPubKey)); - Erase(std::make_pair(std::string("wkey"), vchPubKey)); + Erase(std::make_pair(std::string("key"), vchPubKey.Raw())); + Erase(std::make_pair(std::string("wkey"), vchPubKey.Raw())); } return true; } @@ -120,10 +121,10 @@ public: return Read(std::string("defaultkey"), vchPubKey); } - bool WriteDefaultKey(const std::vector<unsigned char>& vchPubKey) + bool WriteDefaultKey(const CPubKey& vchPubKey) { nWalletDBUpdated++; - return Write(std::string("defaultkey"), vchPubKey); + return Write(std::string("defaultkey"), vchPubKey.Raw()); } bool ReadPool(int64 nPool, CKeyPool& keypool) |