Skip to content

Commit

Permalink
Merge pull request #2136 from rsksmart/check_null_parameter_for_new_a…
Browse files Browse the repository at this point in the history
…ccount_method

Check null value in newAccount method
  • Loading branch information
Vovchyk authored Sep 20, 2023
2 parents 016b547 + bdc6dd1 commit 82079f9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions rskj-core/src/main/java/org/ethereum/rpc/Web3Impl.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import org.ethereum.rpc.dto.CompilationResultDTO;
import org.ethereum.rpc.dto.TransactionReceiptDTO;
import org.ethereum.rpc.dto.TransactionResultDTO;
import org.ethereum.rpc.exception.RskJsonRpcRequestException;
import org.ethereum.rpc.parameters.*;
import org.ethereum.util.BuildInfo;
import org.ethereum.vm.DataWord;
Expand Down Expand Up @@ -419,7 +420,7 @@ private String eth_getCode(HexAddressParam address, Map<String, String> inputs)

@Override
public String eth_getBalance(HexAddressParam address, BlockRefParam blockRefParam) {
if(blockRefParam.getIdentifier() != null) {
if (blockRefParam.getIdentifier() != null) {
return this.eth_getBalance(address, blockRefParam.getIdentifier());
} else {
return this.eth_getBalance(address, blockRefParam.getInputs());
Expand Down Expand Up @@ -462,7 +463,7 @@ public String eth_getBalance(HexAddressParam address) {

@Override
public String eth_getStorageAt(HexAddressParam address, HexNumberParam storageIdx, BlockRefParam blockRefParam) {
if(blockRefParam.getIdentifier() != null) {
if (blockRefParam.getIdentifier() != null) {
return this.eth_getStorageAt(address, storageIdx, blockRefParam.getIdentifier());
} else {
return this.eth_getStorageAt(address, storageIdx, blockRefParam.getInputs());
Expand Down Expand Up @@ -501,7 +502,7 @@ private String eth_getStorageAt(HexAddressParam address, HexNumberParam storageI

@Override
public String eth_getTransactionCount(HexAddressParam address, BlockRefParam blockRefParam) {
if(blockRefParam.getIdentifier() != null) {
if (blockRefParam.getIdentifier() != null) {
return this.eth_getTransactionCount(address, blockRefParam.getIdentifier());
} else {
return this.eth_getTransactionCount(address, blockRefParam.getInputs());
Expand Down Expand Up @@ -1079,11 +1080,17 @@ public void db_getHex() {

@Override
public String personal_newAccountWithSeed(String seed) {
if (seed == null) {
throw RskJsonRpcRequestException.invalidParamError("Seed is null");
}
return personalModule.newAccountWithSeed(seed);
}

@Override
public String personal_newAccount(String passphrase) {
if (passphrase == null) {
throw RskJsonRpcRequestException.invalidParamError("Passphrase is null");
}
return personalModule.newAccount(passphrase);
}

Expand Down

0 comments on commit 82079f9

Please sign in to comment.