Skip to content

Commit

Permalink
downloadFailCount check after increment.
Browse files Browse the repository at this point in the history
  • Loading branch information
nayuta-ueno committed Jul 25, 2019
1 parent 865c203 commit 17a975b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/co/nayuta/lightning/Ptarmigan.java
Original file line number Diff line number Diff line change
Expand Up @@ -478,11 +478,6 @@ private int getTxConfirmationFromBlock(PtarmiganChannel channel, Sha256Hash txHa
while (true) {
Block block = getBlock(blockHash);
if (block == null) {
if (downloadFailCount >= DOWNLOAD_FAIL_COUNT_MAX) {
//
logger.error("stop SPV: too many fail download");
throw new PtarmException();
}
break;
}
logger.debug("getTxConfirmationFromBlock: blockHash(conf=" + (c + 1) + ")=" + blockHash.toString());
Expand Down Expand Up @@ -1348,6 +1343,11 @@ private Block getBlockFromPeer(Sha256Hash blockHash) throws PtarmException {
} catch (Exception e) {
downloadFailCount++;
logger.error("getBlockFromPeer(count=" + downloadFailCount + "): " + getStackTrace(e));
if (downloadFailCount >= DOWNLOAD_FAIL_COUNT_MAX) {
//
logger.error("stop SPV: too many fail download");
throw new PtarmException();
}
}
return block;
}
Expand Down

0 comments on commit 17a975b

Please sign in to comment.