Browse Source

Elaborate which bitcoind has failed responses

master
Con Kolivas 9 years ago
parent
commit
edd79bd8fa
  1. 12
      src/bitcoin.c
  2. 2
      src/generator.c

12
src/bitcoin.c

@ -54,7 +54,7 @@ bool validate_address(connsock_t *cs, const char *address)
snprintf(rpc_req, 128, "{\"method\": \"validateaddress\", \"params\": [\"%s\"]}\n", address); snprintf(rpc_req, 128, "{\"method\": \"validateaddress\", \"params\": [\"%s\"]}\n", address);
val = json_rpc_call(cs, rpc_req); val = json_rpc_call(cs, rpc_req);
if (!val) { if (!val) {
LOGERR("Failed to get valid json response to validate_address"); LOGERR("%s:%s Failed to get valid json response to validate_address", cs->url, cs->port);
return ret; return ret;
} }
res_val = json_object_get(val, "result"); res_val = json_object_get(val, "result");
@ -194,7 +194,7 @@ bool gen_gbtbase(connsock_t *cs, gbtbase_t *gbt)
val = json_rpc_call(cs, gbt_req); val = json_rpc_call(cs, gbt_req);
if (!val) { if (!val) {
LOGWARNING("Failed to get valid json response to getblocktemplate"); LOGWARNING("%s:%s Failed to get valid json response to getblocktemplate", cs->url, cs->port);
return ret; return ret;
} }
res_val = json_object_get(val, "result"); res_val = json_object_get(val, "result");
@ -299,7 +299,7 @@ int get_blockcount(connsock_t *cs)
val = json_rpc_call(cs, blockcount_req); val = json_rpc_call(cs, blockcount_req);
if (!val) { if (!val) {
LOGWARNING("Failed to get valid json response to getblockcount"); LOGWARNING("%s:%s Failed to get valid json response to getblockcount", cs->url, cs->port);
return ret; return ret;
} }
res_val = json_object_get(val, "result"); res_val = json_object_get(val, "result");
@ -325,7 +325,7 @@ bool get_blockhash(connsock_t *cs, int height, char *hash)
sprintf(rpc_req, "{\"method\": \"getblockhash\", \"params\": [%d]}\n", height); sprintf(rpc_req, "{\"method\": \"getblockhash\", \"params\": [%d]}\n", height);
val = json_rpc_call(cs, rpc_req); val = json_rpc_call(cs, rpc_req);
if (!val) { if (!val) {
LOGWARNING("Failed to get valid json response to getblockhash"); LOGWARNING("%s:%s Failed to get valid json response to getblockhash", cs->url, cs->port);
return ret; return ret;
} }
res_val = json_object_get(val, "result"); res_val = json_object_get(val, "result");
@ -356,7 +356,7 @@ bool get_bestblockhash(connsock_t *cs, char *hash)
val = json_rpc_call(cs, bestblockhash_req); val = json_rpc_call(cs, bestblockhash_req);
if (!val) { if (!val) {
LOGWARNING("Failed to get valid json response to getbestblockhash"); LOGWARNING("%s:%s Failed to get valid json response to getbestblockhash", cs->url, cs->port);
return ret; return ret;
} }
res_val = json_object_get(val, "result"); res_val = json_object_get(val, "result");
@ -391,7 +391,7 @@ retry:
val = json_rpc_call(cs, rpc_req); val = json_rpc_call(cs, rpc_req);
dealloc(rpc_req); dealloc(rpc_req);
if (!val) { if (!val) {
LOGWARNING("Failed to get valid json response to submitblock"); LOGWARNING("%s:%s Failed to get valid json response to submitblock", cs->url, cs->port);
if (++retries < 5) if (++retries < 5)
goto retry; goto retry;
return ret; return ret;

2
src/generator.c

@ -302,7 +302,7 @@ retry:
} while (selret < 1); } while (selret < 1);
if (unlikely(cs->fd < 0)) { if (unlikely(cs->fd < 0)) {
LOGWARNING("Bitcoind socket invalidated, will attempt failover"); LOGWARNING("%s:%s Bitcoind socket invalidated, will attempt failover", cs->url, cs->port);
goto reconnect; goto reconnect;
} }

Loading…
Cancel
Save