Daemons will rarely arbitrarily drop blocks that it previously considered valid. This is a bug in the daemon or maybe only in testnet. This fix treats those dropped blocks as orhpans.

This commit is contained in:
Matt 2014-03-27 12:57:56 -06:00
parent c71e9d71c3
commit d3e2057ec9
1 changed files with 15 additions and 4 deletions

View File

@ -137,13 +137,24 @@ function SetupForPool(logger, poolOptions){
return;
}
txDetails = txDetails.filter(function(tx){
if (tx.error || !tx.result){
txDetails.forEach(function(tx, i){
if (tx.error && tx.error.code === -5){
/* Block was dropped from coin daemon even after it happily accepted it earlier.
Must be a bug in the daemon code or maybe only something that happens in testnet.
We handle this by treating it like an orphaned block. */
logger.error(logSystem, logComponent,
'Daemon dropped a previously valid block - we are treating it as an orphaned block');
//These changes to the tx will convert it from dropped to orphan
tx.result = {
txid: rounds[i].txHash,
details: [{category: 'orphan'}]
};
}
else if (tx.error || !tx.result){
logger.error(logSystem, logComponent,
'error with requesting transaction from block daemon: ' + JSON.stringify(tx));
return false;
}
return true;
});