Skip to content
This repository has been archived by the owner on Aug 23, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1235 from iotadevelopment/merge_txrequesterfix
Browse files Browse the repository at this point in the history
Fix: Node requested old transactions forever
  • Loading branch information
GalRogozinski committed Dec 13, 2018
2 parents ffa7a37 + 506e205 commit df04e1b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/java/com/iota/iri/TransactionValidator.java
Expand Up @@ -260,8 +260,8 @@ public boolean checkSolidity(Hash hash, boolean milestone, int maxProcessedTrans
}

final TransactionViewModel transaction = fromHash(tangle, hashPointer);
if(!transaction.isSolid()) {
if (transaction.getType() == PREFILLED_SLOT && !snapshotProvider.getInitialSnapshot().hasSolidEntryPoint(hashPointer)) {
if(!transaction.isSolid() && !snapshotProvider.getInitialSnapshot().hasSolidEntryPoint(hashPointer)) {
if (transaction.getType() == PREFILLED_SLOT) {
solid = false;

if (!transactionRequester.isTransactionRequested(hashPointer, milestone)) {
Expand Down Expand Up @@ -436,13 +436,15 @@ private boolean quickSetSolid(final TransactionViewModel transactionViewModel) t
* @throws Exception if we encounter an error while requesting a transaction
*/
private boolean checkApproovee(TransactionViewModel approovee) throws Exception {
if(approovee.getType() == PREFILLED_SLOT) {
transactionRequester.requestTransaction(approovee.getHash(), false);
return false;
}
if(snapshotProvider.getInitialSnapshot().hasSolidEntryPoint(approovee.getHash())) {
return true;
}
if(approovee.getType() == PREFILLED_SLOT) {
// don't solidify from the bottom until cuckoo filters can identify where we deleted -> otherwise we will
// continue requesting old transactions forever
//transactionRequester.requestTransaction(approovee.getHash(), false);
return false;
}
return approovee.isSolid();
}

Expand Down
Expand Up @@ -147,6 +147,9 @@ public void shutdown() {
*/
private TransactionViewModel getTransactionToSendWithRequest() throws Exception {
Hash tip = tipsViewModel.getRandomSolidTipHash();
if (tip == null) {
tip = tipsViewModel.getRandomNonSolidTipHash();
}

return TransactionViewModel.fromHash(tangle, tip == null ? Hash.NULL_HASH : tip);
}
Expand Down

0 comments on commit df04e1b

Please sign in to comment.