Browse Source

Fixes for OtherAccount plugin.

cl-refactor
Gav Wood 10 years ago
parent
commit
1fbbb60143
  1. 6
      alethzero/OtherAccounts.cpp
  2. 5
      alethzero/Transact.cpp

6
alethzero/OtherAccounts.cpp

@ -34,7 +34,7 @@ DEV_AZ_NOTE_PLUGIN(OtherAccounts);
OtherAccounts::OtherAccounts(MainFace* _m):
AccountNamerPlugin(_m, "OtherAccounts")
{
connect(addMenuItem("New Brain Wallet...", "menuTools", true), SIGNAL(triggered()), SLOT(import()));
connect(addMenuItem("Register Third-party Address Names...", "menuTools", true), SIGNAL(triggered()), SLOT(import()));
}
void OtherAccounts::import()
@ -48,8 +48,8 @@ void OtherAccounts::import()
QStringList sl = u.accounts->toPlainText().split("\n");
for (QString const& s: sl)
{
Address addr = toAddress(s.section("[ \\t]+", 0, 1).toStdString());
string name = s.section("[ \\t]+", 1).toStdString();
Address addr = dev::eth::toAddress(s.section(QRegExp("[ \\0\\t]+"), 0, 0).toStdString());
string name = s.section(QRegExp("[ \\0\\t]+"), 1).toStdString();
m_toName[addr] = name;
m_toAddress[name] = addr;
}

5
alethzero/Transact.cpp

@ -137,7 +137,10 @@ void Transact::updateDestination()
ui->destination->clear();
ui->destination->addItem("(Create Contract)");
for (Address const& a: m_main->allKnownAddresses())
{
cdebug << "Adding" << a << m_main->toName(a) << " -> " << (m_main->toName(a) + " (" + ICAP(a).encoded() + ")");
ui->destination->addItem(QString::fromStdString(m_main->toName(a) + " (" + ICAP(a).encoded() + ")"), QVariant(QByteArray((char const*)a.data(), a.size)));
}
}
void Transact::updateFee()
@ -348,13 +351,11 @@ GasRequirements Transact::determineGasRequirements()
for (unsigned i = 0; i < 20 && ((haveUpperBound && upperBound - lowerBound > 100) || !haveUpperBound); ++i) // get to with 100.
{
qint64 mid = haveUpperBound ? (lowerBound + upperBound) / 2 : upperBound;
cdebug << "Trying" << mid;
ExecutionResult er;
if (isCreation())
er = ethereum()->create(from, value(), m_data, mid, gasPrice(), ethereum()->getDefault(), FudgeFactor::Lenient);
else
er = ethereum()->call(from, value(), to, m_data, mid, gasPrice(), ethereum()->getDefault(), FudgeFactor::Lenient);
cdebug << toString(er.excepted);
if (er.excepted == TransactionException::OutOfGas || er.excepted == TransactionException::OutOfGasBase || er.excepted == TransactionException::OutOfGasIntrinsic || er.codeDeposit == CodeDeposit::Failed)
{
lowerBound = mid;

Loading…
Cancel
Save