Fix test account private key encoding.

This commit is contained in:
Adrian Tiberius 2015-08-04 17:21:25 +02:00
parent 8c9d49e0a8
commit b585afb473
2 changed files with 7 additions and 6 deletions

View File

@ -95,11 +95,11 @@ public class Ethereum implements org.ethereum.facade.Ethereum {
init(null);
}
public void init(List<String> addresses) {
public void init(List<String> privateKeys) {
if (addresses != null) {
for (String address: addresses) {
wallet.importKey(address.getBytes());
if (privateKeys != null) {
for (String privateKey: privateKeys) {
wallet.importKey(Hex.decode(privateKey));
}
}

View File

@ -21,6 +21,7 @@ import org.ethereum.core.TransactionReceipt;
import org.ethereum.crypto.HashUtil;
import org.ethereum.android.Ethereum;
import org.ethereum.net.p2p.HelloMessage;
import org.spongycastle.util.encoders.Hex;
import java.util.ArrayList;
import java.util.List;
@ -80,10 +81,10 @@ public class EthereumService extends Service {
// TODO: Add init and add/remove address service messages
List<String> addresses = new ArrayList<String>();
byte[] cowAddr = HashUtil.sha3("cow".getBytes());
addresses.add(new String(cowAddr));
addresses.add(Hex.toHexString(cowAddr));
String secret = CONFIG.coinbaseSecret();
byte[] cbAddr = HashUtil.sha3(secret.getBytes());
addresses.add(new String(cbAddr));
addresses.add(Hex.toHexString(cbAddr));
ethereum.init(addresses);
isInitialized = true;