Browse Source

Fix --sign-tx in ethkey.

cl-refactor
Gav Wood 10 years ago
parent
commit
18d9398525
  1. 13
      ethkey/KeyAux.h
  2. 7
      libdevcore/FixedHash.cpp

13
ethkey/KeyAux.h

@ -228,19 +228,18 @@ public:
{ {
if (h128 u = fromUUID(_signKey)) if (h128 u = fromUUID(_signKey))
return Secret(secretStore().secret(u, [&](){ return getPassword("Enter password for key: "); })); return Secret(secretStore().secret(u, [&](){ return getPassword("Enter password for key: "); }));
else if (Address a = Address(_signKey)) if (_signKey.substr(0, 6) == "brain:")
return keyManager().secret(a, [&](){ return getPassword("Enter password for key (hint:" + keyManager().passwordHint(a) + "): "); });
else if (_signKey.substr(0, 6) == "brain:")
return KeyManager::brain(_signKey.substr(6)); return KeyManager::brain(_signKey.substr(6));
else if (_signKey == "brain") if (_signKey == "brain")
return KeyManager::brain(getPassword("Enter brain wallet phrase: ")); return KeyManager::brain(getPassword("Enter brain wallet phrase: "));
else Address a;
{ DEV_IGNORE_EXCEPTIONS(a = Address(_signKey));
if (a)
return keyManager().secret(a, [&](){ return getPassword("Enter password for key (hint:" + keyManager().passwordHint(a) + "): "); });
cerr << "Bad file, UUID and address: " << _signKey << endl; cerr << "Bad file, UUID and address: " << _signKey << endl;
exit(-1); exit(-1);
} }
} }
}
void execute() void execute()
{ {

7
libdevcore/FixedHash.cpp

@ -30,7 +30,14 @@ boost::random_device dev::s_fixedHashEngine;
h128 dev::fromUUID(std::string const& _uuid) h128 dev::fromUUID(std::string const& _uuid)
{ {
try
{
return h128(boost::replace_all_copy(_uuid, "-", "")); return h128(boost::replace_all_copy(_uuid, "-", ""));
}
catch (...)
{
return h128();
}
} }
std::string dev::toUUID(h128 const& _uuid) std::string dev::toUUID(h128 const& _uuid)

Loading…
Cancel
Save