Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stratum: fix address ownership check for new bitcoin core based wallets #347

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions stratum/coind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,8 @@ bool coind_validate_address(YAAMP_COIND *coind)
sprintf(params, "[\"%s\"]", coind->wallet);

json_value *json;
bool getaddressinfo = ((strcmp(coind->symbol,"DGB") == 0) || (strcmp(coind->symbol2, "DGB") == 0));
if(getaddressinfo)
json = rpc_call(&coind->rpc, "getaddressinfo", params);
else
json = rpc_call(&coind->rpc, "validateaddress", params);
bool getaddressinfo = false;
json = rpc_call(&coind->rpc, "validateaddress", params);
if(!json) return false;

json_value *json_result = json_get_object(json, "result");
Expand All @@ -129,6 +126,20 @@ bool coind_validate_address(YAAMP_COIND *coind)
return false;
}

if(!json_get_bool(json_result, "ismine"))
{
stratumlog("%s wallet is using getaddressinfo.\n", coind->name);
getaddressinfo = true;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need a json_value_free(json); here to free validateaddress replaced one

json = rpc_call(&coind->rpc, "getaddressinfo", params);

json_result = json_get_object(json, "result");
if(!json_result)
{
json_value_free(json);
return false;
}
}

bool isvalid = getaddressinfo || json_get_bool(json_result, "isvalid");
if(!isvalid) stratumlog("%s wallet %s is not valid.\n", coind->name, coind->wallet);

Expand Down