mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-09-30 07:10:35 +00:00
decred: blockconfirm enhancement with blocknotify(-dcr)
+ some getwork logs on submit errors (not seen yet)
This commit is contained in:
parent
284cbcdae7
commit
8db4565b30
4 changed files with 23 additions and 9 deletions
|
@ -276,7 +276,7 @@ bool client_update_block(YAAMP_CLIENT *client, json_value *json_params)
|
|||
coind->notreportingcounter = 0;
|
||||
|
||||
if (!strcmp("DCR", coind->symbol)) {
|
||||
usleep(500*YAAMP_MS);
|
||||
usleep(300*YAAMP_MS);
|
||||
}
|
||||
|
||||
block_confirm(coind->id, hash);
|
||||
|
|
|
@ -6,13 +6,25 @@ bool coind_submitwork(YAAMP_COIND *coind, const char *block)
|
|||
int paramlen = strlen(block);
|
||||
|
||||
char *params = (char *)malloc(paramlen+1024);
|
||||
if(!params) return false;
|
||||
if(!params) {
|
||||
debuglog("%s: OOM!\n", __func__);
|
||||
return false;
|
||||
}
|
||||
|
||||
sprintf(params, "[\"%s\"]", block);
|
||||
json_value *json = rpc_call(&coind->rpc, "getwork", params);
|
||||
if(!json) {
|
||||
debuglog("%s: retry\n", __func__);
|
||||
usleep(500*YAAMP_MS);
|
||||
json = rpc_call(&coind->rpc, "getwork", params);
|
||||
}
|
||||
free(params);
|
||||
|
||||
if(!json) return false;
|
||||
if(!json) {
|
||||
debuglog("%s: error, no answer\n", __func__);
|
||||
return false;
|
||||
}
|
||||
|
||||
json_value *json_res = json_get_object(json, "result");
|
||||
|
||||
bool b = json_res && json_res->type == json_boolean && json_res->u.boolean;
|
||||
|
|
|
@ -71,15 +71,17 @@ function BackendBlockFind1()
|
|||
$coin = getdbo('db_coins', $db_block->coin_id);
|
||||
if(!$coin->enable) continue;
|
||||
|
||||
// noblocknofify: add a small delay before declaring it orphan
|
||||
if($coin->symbol == 'DCR' && (time() - $db_block->time) < 240)
|
||||
continue;
|
||||
|
||||
$db_block->category = 'orphan';
|
||||
$remote = new Bitcoin($coin->rpcuser, $coin->rpcpasswd, $coin->rpchost, $coin->rpcport);
|
||||
|
||||
$block = $remote->getblock($db_block->blockhash);
|
||||
if(!$block || !isset($block['tx']) || !isset($block['tx'][0]))
|
||||
if($coin->symbol == 'DCR' && (time() - $db_block->time) < 300) {
|
||||
// DCR generated blocks need some time to be accepted by the network
|
||||
if (!$block) continue;
|
||||
$tx = $remote->gettransaction($block['tx'][0]);
|
||||
if (!$tx || !isset($tx['details'])) continue;
|
||||
}
|
||||
else if(!$block || !isset($block['tx']) || !isset($block['tx'][0]))
|
||||
{
|
||||
$db_block->amount = 0;
|
||||
$db_block->save();
|
||||
|
|
|
@ -317,7 +317,7 @@ class SiteController extends CommonController
|
|||
return;
|
||||
}
|
||||
BackendUserCancelFailedPayment($user->id);
|
||||
$this->render('payments');
|
||||
$this->redirect('payments');
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Reference in a new issue