Skip to content

Commit

Permalink
Fixed issue are per #8 - Parity account unlock request with no duration.
Browse files Browse the repository at this point in the history
  • Loading branch information
conor10 committed Nov 4, 2016
1 parent 72bcddf commit 9bc36f8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public void setUp() {

boolean unlockAccount() throws Exception {
PersonalUnlockAccount personalUnlockAccount =
parity.personalUnlockAccount(ALICE.getAddress(), WALLET_PASSWORD, ACCOUNT_UNLOCK_DURATION)
parity.personalUnlockAccount(
ALICE.getAddress(), WALLET_PASSWORD, ACCOUNT_UNLOCK_DURATION)
.sendAsync().get();
return personalUnlockAccount.accountUnlocked();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public Request<?, NewAccountIdentifier> personalNewAccountFromWallet(WalletFile
}

@Override
public Request<?, PersonalUnlockAccount> personalUnlockAccount(String accountId, String password, BigInteger duration) {
public Request<?, PersonalUnlockAccount> personalUnlockAccount(
String accountId, String password, BigInteger duration) {
List<Object> attributes = new ArrayList<>(3);
attributes.add(accountId);
attributes.add(password);
Expand All @@ -80,6 +81,8 @@ public Request<?, PersonalUnlockAccount> personalUnlockAccount(String accountId,
// Parity has a bug where it won't support a duration
// See https://github.com/ethcore/parity/issues/1215
attributes.add(duration.longValue());
} else {
attributes.add(null); // we still need to include the null value, otherwise Parity rejects
}

return new Request<>(
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/web3j/protocol/parity/RequestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void testPersonalUnlockAccount() throws Exception {
public void testPersonalUnlockAccountNoDuration() throws Exception {
web3j.personalUnlockAccount("0xfc390d8a8ddb591b010fda52f4db4945742c3809", "hunter2").send();

verifyResult("{\"jsonrpc\":\"2.0\",\"method\":\"personal_unlockAccount\",\"params\":[\"0xfc390d8a8ddb591b010fda52f4db4945742c3809\",\"hunter2\"],\"id\":1}");
verifyResult("{\"jsonrpc\":\"2.0\",\"method\":\"personal_unlockAccount\",\"params\":[\"0xfc390d8a8ddb591b010fda52f4db4945742c3809\",\"hunter2\",null],\"id\":1}");
}

@Test
Expand Down

0 comments on commit 9bc36f8

Please sign in to comment.