Skip to content

Commit

Permalink
Fix reading tx-pool-min-score option from configuration file
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
  • Loading branch information
fab-10 committed Sep 16, 2024
1 parent 89dfa95 commit e8305ca
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ private String getConfigurationValue(final OptionSpec optionSpec) {
}

private boolean isNumericType(final Class<?> type) {
return type.equals(Integer.class)
return type.equals(Byte.class)
|| type.equals(byte.class)
|| type.equals(Short.class)
|| type.equals(short.class)
|| type.equals(Integer.class)
|| type.equals(int.class)
|| type.equals(Long.class)
|| type.equals(long.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,24 @@ public void minScoreWorks() {
Byte.toString(minScore));
}

@Test
public void minScoreWorksConfigFile() throws IOException {
final byte minScore = -10;
final Path tempConfigFilePath =
createTempFile(
"config",
String.format(
"""
tx-pool-min-score=%s
""",
minScore));

internalTestSuccess(
config -> assertThat(config.getMinScore()).isEqualTo(minScore),
"--config-file",
tempConfigFilePath.toString());
}

@Test
public void minScoreNonByteValueReturnError() {
final var overflowMinScore = Integer.toString(-300);
Expand Down

0 comments on commit e8305ca

Please sign in to comment.