Browse Source

Brain wallet annotation in AZ.

cl-refactor
Gav Wood 10 years ago
parent
commit
c89a303493
  1. 2
      alethzero/MainWin.cpp
  2. 1
      libethcore/KeyManager.cpp
  3. 3
      libethcore/KeyManager.h

2
alethzero/MainWin.cpp

@ -1179,7 +1179,7 @@ void Main::refreshBalances()
for (auto const& address: m_keyManager.accounts())
{
u256 b = ethereum()->balanceAt(address);
QListWidgetItem* li = new QListWidgetItem(QString("%4 %2: %1 [%3]").arg(formatBalance(b).c_str()).arg(QString::fromStdString(render(address))).arg((unsigned)ethereum()->countAt(address)).arg(QString::fromStdString(m_keyManager.accountName(address))), ui->ourAccounts);
QListWidgetItem* li = new QListWidgetItem(QString("<%5> %4 %2: %1 [%3]").arg(formatBalance(b).c_str()).arg(QString::fromStdString(render(address))).arg((unsigned)ethereum()->countAt(address)).arg(QString::fromStdString(m_keyManager.accountName(address))).arg(m_keyManager.haveKey(address) ? "KEY" : "BRAIN"), ui->ourAccounts);
li->setData(Qt::UserRole, QByteArray((char const*)address.data(), Address::size));
li->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
li->setCheckState(m_beneficiary == address ? Qt::Checked : Qt::Unchecked);

1
libethcore/KeyManager.cpp

@ -112,7 +112,6 @@ bool KeyManager::load(string const& _pass)
// TODO: brain wallet.
m_keyInfo[addr] = KeyInfo(h256(i[2]), string(i[3]), i.itemCount() > 4 ? string(i[4]) : "");
}
// cdebug << toString(addr) << toString(uuid) << toString((h256)i[2]) << (string)i[3];
}

3
libethcore/KeyManager.h

@ -97,6 +97,9 @@ public:
/// @returns the password hint for the account for the given address;
std::string const& passwordHint(Address const& _address) const;
/// @returns true if the given address has a key (UUID) associated with it. Equivalent to !!uuid(_a)
/// If the address has no key, it could be a brain wallet.
bool haveKey(Address const& _a) const { return m_addrLookup.count(_a); }
/// @returns the uuid of the key for the address @a _a or the empty hash on error.
h128 uuid(Address const& _a) const;
/// @returns the address corresponding to the key with uuid @a _uuid or the zero address on error.

Loading…
Cancel
Save