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); init(null);
} }
public void init(List<String> addresses) { public void init(List<String> privateKeys) {
if (addresses != null) { if (privateKeys != null) {
for (String address: addresses) { for (String privateKey: privateKeys) {
wallet.importKey(address.getBytes()); wallet.importKey(Hex.decode(privateKey));
} }
} }

View File

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