diff --git a/alethzero/Main.ui b/alethzero/Main.ui index 466301c0b..9e1042a59 100644 --- a/alethzero/Main.ui +++ b/alethzero/Main.ui @@ -367,8 +367,8 @@ - 433 - 326 + 442 + 360 @@ -382,53 +382,46 @@ - - - - false - - - true - - - + + + + + 0 + 0 + - - - - - Send + To - + Amount - - - - + + + + + 0 + 0 + - - 430000000 + + Data - - 1000 + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - + - Qt::Horizontal + Qt::Vertical @@ -438,6 +431,20 @@ + + + + Send + + + + + + + + + + @@ -451,49 +458,42 @@ - - - - + + + + false - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + true + + + - - - - - 0 - 0 - - + + + + + - Data + - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - 0 - 0 - + + + + - - To + + 430000000 - - - - - - + + 1000 diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 34561630b..0ebf726a2 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -82,7 +82,7 @@ QString Main::render(eth::Address _a) const { QString p = pretty(_a); if (!p.isNull()) - return p + "(" + QString::fromStdString(_a.abridged()) + ")"; + return p + " (" + QString::fromStdString(_a.abridged()) + ")"; return QString::fromStdString(_a.abridged()); } @@ -190,26 +190,31 @@ void Main::refresh() auto acs = m_client->state().addresses(); ui->accounts->clear(); ui->contracts->clear(); - for (auto i: acs) - { - (new QListWidgetItem(QString("%1 [%3] @ %2").arg(formatBalance(i.second).c_str()).arg(render(i.first)).arg((unsigned)m_client->state().transactionsFrom(i.first)), ui->accounts)) - ->setData(Qt::UserRole, QByteArray((char const*)i.first.data(), Address::size)); - if (m_client->state().isContractAddress(i.first)) - (new QListWidgetItem(QString("%1 [%3] @ %2").arg(formatBalance(i.second).c_str()).arg(render(i.first)).arg((unsigned)m_client->state().transactionsFrom(i.first)), ui->contracts)) - ->setData(Qt::UserRole, QByteArray((char const*)i.first.data(), Address::size)); - } + for (auto n = 0; n < 2; ++n) + for (auto i: acs) + { + auto r = render(i.first); + if (r.contains('(') == !n) + { + (new QListWidgetItem(QString("%2: %1 [%3]").arg(formatBalance(i.second).c_str()).arg(r).arg((unsigned)m_client->state().transactionsFrom(i.first)), ui->accounts)) + ->setData(Qt::UserRole, QByteArray((char const*)i.first.data(), Address::size)); + if (m_client->state().isContractAddress(i.first)) + (new QListWidgetItem(QString("%2: %1 [%3]").arg(formatBalance(i.second).c_str()).arg(r).arg((unsigned)m_client->state().transactionsFrom(i.first)), ui->contracts)) + ->setData(Qt::UserRole, QByteArray((char const*)i.first.data(), Address::size)); + } + } ui->transactionQueue->clear(); for (Transaction const& t: m_client->pending()) { QString s = t.receiveAddress ? - QString("%1 [%4] %2 %5> %3") + QString("%2 %5> %3: %1 [%4]") .arg(formatBalance(t.value).c_str()) .arg(render(t.safeSender())) .arg(render(t.receiveAddress)) .arg((unsigned)t.nonce) .arg(m_client->state().isContractAddress(t.receiveAddress) ? '*' : '-') : - QString("%1 [%4] %2 +> %3") + QString("%2 +> %3: %1 [%4]") .arg(formatBalance(t.value).c_str()) .arg(render(t.safeSender())) .arg(render(right160(t.sha3()))) @@ -229,13 +234,13 @@ void Main::refresh() { Transaction t(i.data()); QString s = t.receiveAddress ? - QString(" %1 [%4] %2 %5> %3") + QString(" %2 %5> %3: %1 [%4]") .arg(formatBalance(t.value).c_str()) .arg(render(t.safeSender())) .arg(render(t.receiveAddress)) .arg((unsigned)t.nonce) .arg(m_client->state().isContractAddress(t.receiveAddress) ? '*' : '-') : - QString(" %1 [%4] %2 +> %3") + QString(" %2 +> %3: %1 [%4]") .arg(formatBalance(t.value).c_str()) .arg(render(t.safeSender())) .arg(render(right160(t.sha3()))) @@ -256,7 +261,7 @@ void Main::refresh() for (auto i: m_myKeys) { u256 b = m_client->state().balance(i.address()); - (new QListWidgetItem(QString("%1 [%3] @ %2").arg(formatBalance(b).c_str()).arg(render(i.address())).arg((unsigned)m_client->state().transactionsFrom(i.address())), ui->ourAccounts)) + (new QListWidgetItem(QString("%2: %1 [%3]").arg(formatBalance(b).c_str()).arg(render(i.address())).arg((unsigned)m_client->state().transactionsFrom(i.address())), ui->ourAccounts)) ->setData(Qt::UserRole, QByteArray((char const*)i.address().data(), Address::size)); totalBalance += b; } @@ -319,8 +324,6 @@ void Main::on_blocks_currentItemChanged() // s << "0x" << hex << i << " "; s << "
" << disassemble(tx.data); } - cnote << block; - cnote << asHex(blockData); } @@ -343,13 +346,15 @@ void Main::on_contracts_currentItemChanged() auto mem = m_client->state().contractMemory(h); u256 next = 0; unsigned numerics = 0; + bool unexpectedNumeric = false; for (auto i: mem) { if (next < i.first) { unsigned j; for (j = 0; j <= numerics && next + j < i.first; ++j) - s << (j < numerics ? " 0" : " STOP"); + s << (j < numerics || unexpectedNumeric ? " 0" : " STOP"); + unexpectedNumeric = false; numerics -= min(numerics, j); if (next + j < i.first) s << " ...
@" << showbase << hex << i.first << "    "; @@ -363,6 +368,8 @@ void Main::on_contracts_currentItemChanged() { if (numerics) numerics--; + else + unexpectedNumeric = true; s << " " << showbase << hex << i.second; } else @@ -403,6 +410,13 @@ void Main::on_accounts_doubleClicked() qApp->clipboard()->setText(QString::fromStdString(asHex(h.asArray()))); } +void Main::on_contracts_doubleClicked() +{ + auto hba = ui->contracts->currentItem()->data(Qt::UserRole).toByteArray(); + auto h = Address((byte const*)hba.data(), Address::ConstructFromPointer); + qApp->clipboard()->setText(QString::fromStdString(asHex(h.asArray()))); +} + void Main::on_destination_textChanged() { if (ui->destination->text().size()) diff --git a/alethzero/MainWin.h b/alethzero/MainWin.h index a9e479f58..89ff2667a 100644 --- a/alethzero/MainWin.h +++ b/alethzero/MainWin.h @@ -39,6 +39,7 @@ private slots: void on_valueUnits_currentIndexChanged() { updateFee(); } void on_log_doubleClicked(); void on_blocks_currentItemChanged(); + void on_contracts_doubleClicked(); void on_contracts_currentItemChanged(); void on_about_triggered(); void on_quit_triggered() { close(); } diff --git a/libethereum/PeerNetwork.cpp b/libethereum/PeerNetwork.cpp index add5b6638..7bf32f7c6 100644 --- a/libethereum/PeerNetwork.cpp +++ b/libethereum/PeerNetwork.cpp @@ -924,6 +924,9 @@ bool PeerServer::sync(BlockChain& _bc, TransactionQueue& _tq, Overlay& _o) m_transactionsSent.insert(sha3(*it)); // if we already had the transaction, then don't bother sending it on. m_incomingTransactions.clear(); + auto h = _bc.currentHash(); + bool resendAll = (h != m_latestBlockSent); + // Send any new transactions. for (auto j: m_peers) if (auto p = j.second.lock()) @@ -931,7 +934,7 @@ bool PeerServer::sync(BlockChain& _bc, TransactionQueue& _tq, Overlay& _o) bytes b; uint n = 0; for (auto const& i: _tq.transactions()) - if ((!m_transactionsSent.count(i.first) && !p->m_knownTransactions.count(i.first)) || p->m_requireTransactions) + if ((!m_transactionsSent.count(i.first) && !p->m_knownTransactions.count(i.first)) || p->m_requireTransactions || resendAll) { b += i.second; ++n; @@ -951,7 +954,6 @@ bool PeerServer::sync(BlockChain& _bc, TransactionQueue& _tq, Overlay& _o) } // Send any new blocks. - auto h = _bc.currentHash(); if (h != m_latestBlockSent) { // TODO: find where they diverge and send complete new branch.