16 QObject(parent), wallet(wallet), optionsModel(optionsModel), addressTableModel(0),
17 transactionTableModel(0),
18 cachedBalance(0), cachedUnconfirmedBalance(0), cachedImmatureBalance(0),
19 cachedNumTransactions(0),
20 cachedEncryptionStatus(Unencrypted),
44 std::vector<COutput> vCoins;
46 BOOST_FOREACH(
const COutput& out, vCoins)
47 nBalance += out.
tx->
vout[out.
i].nValue;
67 int numTransactions = 0;
74 return numTransactions;
106 emit
balanceChanged(newBalance, newUnconfirmedBalance, newImmatureBalance);
135 return addressParsed.
IsValid();
141 bool fGood = vchSecret.
SetString(privKey.toStdString());
155 printf(
"importing walling with public key %s\n", vchAddress.
ToString().c_str());
163 QSet<QString> setAddress;
166 if(recipients.empty())
178 setAddress.insert(rcp.
address);
187 if(recipients.size() > setAddress.size())
208 std::vector<std::pair<CScript, int64> > vecSend;
213 vecSend.push_back(make_pair(scriptPubKey, rcp.
amount));
218 int64 nFeeRequired = 0;
219 std::string strFailReason;
224 if((total + nFeeRequired) > nBalance)
228 emit
message(tr(
"Send Coins"), QString::fromStdString(strFailReason),
246 std::string strAddress = rcp.
address.toStdString();
248 std::string strLabel = rcp.
label.toStdString();
344 QMetaObject::invokeMethod(walletmodel,
"updateStatus", Qt::QueuedConnection);
350 QMetaObject::invokeMethod(walletmodel,
"updateAddressBook", Qt::QueuedConnection,
351 Q_ARG(QString, QString::fromStdString(
CBitcoinAddress(address).ToString())),
352 Q_ARG(QString, QString::fromStdString(label)),
360 QMetaObject::invokeMethod(walletmodel,
"updateTransaction", Qt::QueuedConnection,
361 Q_ARG(QString, QString::fromStdString(hash.
GetHex())),
376 wallet->
NotifyStatusChanged.disconnect(boost::bind(&NotifyKeyStoreStatusChanged,
this, _1));
407 wallet->setWalletLocked(
true);
420 return wallet->
GetPubKey(address, vchPubKeyOut);
426 BOOST_FOREACH(
const COutPoint& outpoint, vOutpoints)
430 vOutputs.push_back(out);
437 std::vector<COutput> vCoins;
440 std::vector<COutPoint> vLockedCoins;
444 BOOST_FOREACH(
const COutPoint& outpoint, vLockedCoins)
448 vCoins.push_back(out);
451 BOOST_FOREACH(
const COutput& out, vCoins)
457 if (!wallet->
mapWallet.count(cout.
tx->
vin[0].prevout.hash))
break;
TransactionTableModel * transactionTableModel
void getOutputs(const std::vector< COutPoint > &vOutpoints, std::vector< COutput > &vOutputs)
bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey)
void lockCoin(COutPoint &output)
SendCoinsReturn sendCoins(const QList< SendCoinsRecipient > &recipients, const CCoinControl *coinControl=NULL)
bool IsMine(const CTxIn &txin) const
qint64 getImmatureBalance() const
qint64 cachedImmatureBalance
void ListLockedCoins(std::vector< COutPoint > &vOutpts)
CCriticalSection cs_wallet
int64 GetUnconfirmedBalance() const
qint64 cachedNumTransactions
qint64 cachedUnconfirmedBalance
UnlockContext requestUnlock()
void unsubscribeFromCoreSignals()
bool isLockedCoin(uint256 hash, unsigned int n) const
bool backupWallet(const QString &filename)
void updateTransaction(const QString &hash, int status)
AddressTableModel * getAddressTableModel()
Keystore which keeps the private keys encrypted.
void updateEntry(const QString &address, const QString &label, bool isMine, int status)
CTxDestination Get() const
void ReacceptWalletTransactions()
bool GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const
bool SetAddressBookName(const CTxDestination &address, const std::string &strName)
bool SetString(const char *pszSecret)
UnlockContext(WalletModel *wallet, bool valid, bool relock)
void SetDestination(const CTxDestination &address)
void balanceChanged(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance)
boost::signals2::signal< void(CWallet *wallet, const uint256 &hashTx, ChangeType status)> NotifyTransactionChanged
Wallet transaction added, removed or updated.
WalletModel(CWallet *wallet, OptionsModel *optionsModel, QObject *parent=0)
boost::signals2::signal< void(CCryptoKeyStore *wallet)> NotifyStatusChanged
void checkBalanceChanged()
void numTransactionsChanged(int count)
void LockCoin(COutPoint &output)
bool ChangeWalletPassphrase(const SecureString &strOldWalletPassphrase, const SecureString &strNewWalletPassphrase)
ChangeType
General change type (added, updated, removed).
CPubKey GetPubKey() const
bool changePassphrase(const SecureString &oldPass, const SecureString &newPass)
A base58-encoded secret key.
std::vector< CTxOut > vout
void UnlockCoin(COutPoint &output)
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
qint64 getUnconfirmedBalance() const
int64 GetImmatureBalance() const
An encapsulated public key.
bool getPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const
CClientUIInterface uiInterface
void updateAddressBook(const QString &address, const QString &label, bool isMine, int status)
boost::signals2::signal< bool(int64 nFeeRequired), boost::signals2::last_value< bool > > ThreadSafeAskFee
Ask the user whether they want to pay a fee or not.
bool CommitTransaction(CWalletTx &wtxNew, CReserveKey &reservekey)
std::string ToString() const
OptionsModel * optionsModel
TransactionTableModel * getTransactionTableModel()
void AvailableCoins(std::vector< COutput > &vCoins, bool fOnlyConfirmed=true, const CCoinControl *coinControl=NULL) const
EncryptionStatus cachedEncryptionStatus
An outpoint - a combination of a transaction hash and an index n into its vout.
void CopyFrom(const UnlockContext &rhs)
std::string GetHex() const
UI model for the transaction table of a wallet.
int OutputDebugStringF(const char *pszFormat,...)
Qt model of the address book in the core.
bool setWalletLocked(bool locked, const SecureString &passPhrase=SecureString())
A transaction with a bunch of additional info that only the owner cares about.
void encryptionStatusChanged(int status)
EncryptionStatus getEncryptionStatus() const
bool validateAddress(const QString &address)
CBlockIndex * pindexGenesisBlock
int ScanForWalletTransactions(CBlockIndex *pindexStart, bool fUpdate=false)
bool EncryptWallet(const SecureString &strWalletPassphrase)
bool importPrivateKey(QString privKey)
void listLockedCoins(std::vector< COutPoint > &vOutpts)
A key allocated from the key pool.
Interface from Qt to configuration data structure for Bitcoin client.
Serialized script, used inside transaction inputs and outputs.
Interface to Bitcoin wallet from Qt view code.
std::string ToString() const
bool setWalletEncrypted(bool encrypted, const SecureString &passphrase)
void unlockCoin(COutPoint &output)
void message(const QString &title, const QString &message, unsigned int style)
A reference to a CKey: the Hash160 of its serialized public key.
qint64 getBalance(const CCoinControl *coinControl=NULL) const
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
bool Unlock(const SecureString &strWalletPassphrase)
void updateTransaction(const QString &hash, int status)
bool IsChange(const CTxOut &txout) const
int getNumTransactions() const
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
bool BackupWallet(const CWallet &wallet, const std::string &strDest)
std::map< CTxDestination, std::string > mapAddressBook
std::map< uint256, CWalletTx > mapWallet
boost::signals2::signal< void(CWallet *wallet, const CTxDestination &address, const std::string &label, bool isMine, ChangeType status)> NotifyAddressBookChanged
Address book entry changed.
AddressTableModel * addressTableModel
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
An encapsulated private key.
void listCoins(std::map< QString, std::vector< COutput > > &mapCoins) const
bool IsLockedCoin(uint256 hash, unsigned int n) const
bool CreateTransaction(const std::vector< std::pair< CScript, int64 > > &vecSend, CWalletTx &wtxNew, CReserveKey &reservekey, int64 &nFeeRet, std::string &strFailReason, const CCoinControl *coinControl=NULL)
void pollBalanceChanged()
OptionsModel * getOptionsModel()
void subscribeToCoreSignals()