This commit is contained in:
romanman 2014-05-21 20:08:15 +03:00
parent da85fa993b
commit b52da2cf4a
3 changed files with 11 additions and 8 deletions

View File

@ -9,6 +9,7 @@ import org.ethereum.util.RLPItem;
import org.ethereum.util.RLPList;
import org.spongycastle.util.BigIntegers;
import java.security.SignatureException;
import java.util.Arrays;
/**
@ -184,13 +185,15 @@ public class Transaction {
}
public byte[] sender() {
ECKey eckey = this.getKey();
// Validate the returned key.
// Return null if public key isn't in a correct format
if (!eckey.isPubKeyCanonical()) {
return null;
ECKey key = null;
try {
key = ECKey.signatureToKey(getHash(), getSignature().toBase64());
} catch (SignatureException e) {
e.printStackTrace();
}
return eckey.getAddress();
return key.getAddress();
}
public void sign(byte[] privKeyBytes) throws Exception {

View File

@ -69,7 +69,7 @@ class PayOutDialog extends JDialog {
BigInteger value = new BigInteger(amountInput.getText());
byte[] address = Hex.decode(receiverInput.getText());
byte[] senderPrivKey = HashUtil.sha3("cow".getBytes());
byte[] senderPrivKey = HashUtil.sha3(addressState.getEcKey().getPrivKeyBytes());
byte[] nonce = addressState.getNonce() == BigInteger.ZERO ?
null : addressState.getNonce().toByteArray();

View File

@ -29,7 +29,7 @@ public class StaticMessages {
public static final byte[] DISCONNECT_00 = Hex.decode("2240089100000003C20100");
public static final byte[] GET_CHAIN = Hex.decode("2240089100000027F82514A069A7356A245F9DC5B865475ADA5EE4E89B18F93C06503A9DB3B3630E88E9FB4E820100");
public static final byte[] GENESIS_HASH = Hex.decode("c305511e7cb9b33767e50f5e94ecd7b1c51359a04f45183860ec6808d80b0d3f");
public static final byte[] GENESIS_HASH = Hex.decode("f5232afe32aba6b366f8aa86a6939437c5e13d1fd71a0f51e77735d3456eb1a6");
public static final byte[] MAGIC_PACKET = Hex.decode("22400891");
static {