Skip to content

Commit

Permalink
java: change Host.account_exists to return boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Oct 9, 2020
1 parent 57bbfb5 commit 9f1d867
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bindings/java/c/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static void CopyFromByteBuffer(JNIEnv* jenv, jobject src, void* dst, size_t size
static bool account_exists_fn(struct evmc_host_context* context, const evmc_address* address)
{
const char java_method_name[] = "account_exists";
const char java_method_signature[] = "(I[B)I";
const char java_method_signature[] = "(I[B)Z";

assert(context != NULL);
JNIEnv* jenv = attach();
Expand All @@ -70,7 +70,7 @@ static bool account_exists_fn(struct evmc_host_context* context, const evmc_addr
jbyteArray jaddress = CopyDataToJava(jenv, address, sizeof(struct evmc_address));

// call java method
jint jresult = (*jenv)->CallStaticIntMethod(jenv, host_class, method, context->index, jaddress);
jboolean jresult = (*jenv)->CallStaticIntMethod(jenv, host_class, method, context->index, jaddress);
return jresult != 0;
}

Expand Down
4 changes: 2 additions & 2 deletions bindings/java/java/src/main/java/org/ethereum/evmc/Host.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
*/
final class Host {
/** Check account existence callback function. */
static int account_exists(int context_index, byte[] address) {
static boolean account_exists(int context_index, byte[] address) {
HostContext context =
requireNonNull(
getContext(context_index),
"HostContext does not exist for context_index: " + context_index);
return context.accountExists(address) ? 1 : 0;
return context.accountExists(address);
}

/** Get storage callback function. */
Expand Down

0 comments on commit 9f1d867

Please sign in to comment.