diff --git a/ethereumj-core/src/main/java/org/ethereum/core/Transaction.java b/ethereumj-core/src/main/java/org/ethereum/core/Transaction.java index 18f93b0e3f..1d9fd75e48 100644 --- a/ethereumj-core/src/main/java/org/ethereum/core/Transaction.java +++ b/ethereumj-core/src/main/java/org/ethereum/core/Transaction.java @@ -374,7 +374,7 @@ public boolean isContractCreation() { public ECKey getKey() { byte[] hash = getRawHash(); - return ECKey.recoverFromSignature(signature.v, signature, hash); + return ECKey.recoverFromSignature(0, signature, hash); } public synchronized byte[] getSender() { diff --git a/ethereumj-core/src/test/java/org/ethereum/core/TransactionTest.java b/ethereumj-core/src/test/java/org/ethereum/core/TransactionTest.java index bf808643b2..acb525889d 100644 --- a/ethereumj-core/src/test/java/org/ethereum/core/TransactionTest.java +++ b/ethereumj-core/src/test/java/org/ethereum/core/TransactionTest.java @@ -787,4 +787,13 @@ public void unsignedChainIdTransactionTest() { Transaction copyTx = new Transaction(tx.getNonce(), tx.getGasPrice(), tx.getGasLimit(), tx.getReceiveAddress(), tx.getValue(), tx.getData(), tx.getChainId()); assertArrayEquals(rlpUnsignedTx, copyTx.getEncoded()); } + + @Test + public void testGetKeyFromSignature() { + ECKey sender = new ECKey(); + BlockchainImpl blockchain = ImportLightTest.createBlockchain(GenesisLoader.loadGenesis( + getClass().getResourceAsStream("/genesis/genesis-light.json"))); + Transaction tx = createTx(blockchain, sender, new byte[32], new byte[0], 100); + Assert.assertNotNull(tx.getKey()); + } }