Skip to content

Commit

Permalink
Make getDerivedHDAddress return address, not key
Browse files Browse the repository at this point in the history
Addresses GH #217.
  • Loading branch information
chromatic committed Jun 10, 2024
1 parent dc499c5 commit 6dddb2b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/address.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,7 @@ int getDerivedHDAddress(const char* masterkey, uint32_t account, bool ischange,
return false;
}

int ret = getDerivedHDKeyByPath(masterkey, derived_path, outaddress, outprivkey);
return ret;
return getDerivedHDAddressByPath(masterkey, derived_path, outaddress);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions test/address_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ void test_address()
char* masterkey_main_ext = "dgpv51eADS3spNJh8h13wso3DdDAw3EJRqWvftZyjTNCFEG7gqV6zsZmucmJR6xZfvgfmzUthVC6LNicBeNNDQdLiqjQJjPeZnxG8uW3Q3gCA3e";
int res = getDerivedHDAddress(masterkey_main_ext, 0, false, 0, extout, true);
u_assert_int_eq(res, true);
u_assert_str_eq(extout, "dgpv5BeiZXttUioRMzXUhD3s2uE9F23EhAwFu9meZeY9G99YS6hJCsQ9u6PRsAG3qfVwB1T7aQTVGLsmpxMiczV1dRDgzpbUxR7utpTRmN41iV7");
u_assert_str_eq(extout, "DCm7oSg95sxwn3sWxYUDHgKKbB2mDmuR3B");
res = getDerivedHDAddress(masterkey_main_ext, 0, true, 0, extout, true);
u_assert_int_eq(res, true);
u_assert_str_eq(extout, "dgpv5B5FdsPKQH8hK3vUo5ZR9ZXktfUxv1PStiM2TfnwH9oct5nJwAUx28356eNXoUwcNwzvfVRSDVh85aV3CQdKpQo2Vm8MKyz7KsNAXTEMbeS");
u_assert_str_eq(extout, "D91jVi3CVGhRmyt83fhMdL4UJWtDuiTZET");
res = getDerivedHDAddress(masterkey_main_ext, 0, false, 0, extout, false);
u_assert_int_eq(res, true);
u_assert_str_eq(extout, "dgub8vXjuDpn2sTkerBdjSfq9kmjhaQsXHxyBkYrikw84GCYz9ozcdwvYPo5SSDWqZUVT5d4jrG8CHiGsC1M7pdETPhoKiQa92znT2vG9YaytBH");
Expand Down

0 comments on commit 6dddb2b

Please sign in to comment.