Browse Source

ICAP Cleanups.

cl-refactor
Gav Wood 10 years ago
parent
commit
0f64ad60ee
  1. 6
      libethcore/ICAP.cpp
  2. 6
      libethcore/ICAP.h
  3. 2
      libethereum/Transaction.cpp
  4. 2
      libethereum/Transaction.h

6
libethcore/ICAP.cpp

@ -141,15 +141,13 @@ Address ICAP::lookup(std::function<bytes(Address, bytes)> const& _call, Address
if (m_asset == "XET") if (m_asset == "XET")
{ {
// TODO // TODO
// _call(_reg, ); throw InterfaceNotSupported("ICAP::lookup(), XET asset");
return Address();
} }
else if (m_asset == "ETH") else if (m_asset == "ETH")
{ {
// TODO // TODO
// return resolve(m_institution + "/" + m_client).primary(); // return resolve(m_institution + "/" + m_client).primary();
return Address(); throw InterfaceNotSupported("ICAP::lookup(), ETH asset");
} }
else else
throw InterfaceNotSupported("ICAP::lookup(), non XET asset"); throw InterfaceNotSupported("ICAP::lookup(), non XET asset");

6
libethcore/ICAP.h

@ -39,6 +39,10 @@ struct InvalidICAP: virtual public dev::Exception {};
static const std::string EmptyString; static const std::string EmptyString;
/**
* @brief Encapsulation of an ICAP address.
* Can be encoded, decoded, looked-up and inspected.
*/
class ICAP class ICAP
{ {
public: public:
@ -74,7 +78,7 @@ public:
/// @returns type of ICAP. /// @returns type of ICAP.
Type type() const { return m_type; } Type type() const { return m_type; }
/// @returns target address. Only valid when type() == Direct. /// @returns target address. Only valid when type() == Direct.
Address const& direct() const { return m_type == Direct ? m_direct : Address(); } Address const& direct() const { return m_type == Direct ? m_direct : ZeroAddress; }
/// @returns asset. Only valid when type() == Indirect. /// @returns asset. Only valid when type() == Indirect.
std::string const& asset() const { return m_type == Indirect ? m_asset : EmptyString; } std::string const& asset() const { return m_type == Indirect ? m_asset : EmptyString; }
/// @returns target name. Only valid when type() == Indirect and asset() == "ETH". /// @returns target name. Only valid when type() == Indirect and asset() == "ETH".

2
libethereum/Transaction.cpp

@ -105,7 +105,7 @@ Address const& Transaction::safeSender() const noexcept
catch (...) catch (...)
{ {
cwarn << "safeSender() did throw an exception: " << boost::current_exception_diagnostic_information(); cwarn << "safeSender() did throw an exception: " << boost::current_exception_diagnostic_information();
return NullAddress; return ZeroAddress;
} }
} }

2
libethereum/Transaction.h

@ -97,8 +97,6 @@ struct ExecutionResult
std::ostream& operator<<(std::ostream& _out, ExecutionResult const& _er); std::ostream& operator<<(std::ostream& _out, ExecutionResult const& _er);
static const Address NullAddress;
/// Encodes a transaction, ready to be exported to or freshly imported from RLP. /// Encodes a transaction, ready to be exported to or freshly imported from RLP.
class Transaction class Transaction
{ {

Loading…
Cancel
Save