iotaledger / cliri

Coo Less IRI
Other
24 stars 8 forks source link

Bug: node gives error on startup #97

Closed alongalky closed 5 years ago

alongalky commented 5 years ago

This is an issue caused by #96 .

Error log:

02/03 14:07:25.608 [Transaction Stats Publisher] ERROR c.i.i.s.s.TransactionStatsPublisher - Error while getting transaction counts : {}
java.lang.IllegalStateException: no tips found in largest connected component.
        at com.iota.iri.service.tipselection.impl.ConnectedComponentsStartingTipSelector.randomlySelectTipFromLargestConnectedComponent(ConnectedComponentsStartingTipSelector.java:120) ~[iri-oracle8.jar:na]
        at com.iota.iri.service.tipselection.impl.ConnectedComponentsStartingTipSelector.getTip(ConnectedComponentsStartingTipSelector.java:35) ~[iri-oracle8.jar:na]
        at com.iota.iri.service.tipselection.impl.EntryPointSelectorCumulativeWeightThreshold.getEntryPoint(EntryPointSelectorCumulativeWeightThreshold.java:39) ~[iri-oracle8.jar:na]
        at com.iota.iri.service.tipselection.impl.TipSelectorImpl.getTransactionsToApprove(TipSelectorImpl.java:72) ~[iri-oracle8.jar:na]
        at com.iota.iri.service.stats.TransactionStatsPublisher.getSuperTip(TransactionStatsPublisher.java:95) ~[iri-oracle8.jar:na]
        at com.iota.iri.service.stats.TransactionStatsPublisher.getConfirmedTransactionsCount(TransactionStatsPublisher.java:102) ~[iri-oracle8.jar:na]
        at com.iota.iri.service.stats.TransactionStatsPublisher.lambda$getRunnable$0(TransactionStatsPublisher.java:75) ~[iri-oracle8.jar:na]
        at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_181]
alongalky commented 5 years ago

Diagnosis: bug is due to an issue in findNMostRecentTransactions::findNMostRecentTransactions, fix on the way.

alon-e commented 5 years ago

tipsViewModel.getLatestSolidTips() returns an empty list if no tips exist. should we return NULL_HASH instead?

i.e. :

    public List<Hash> getLatestSolidTips(int count) {
        List<Hash> result = new ArrayList<>();

        int i = 0;
        Iterator<Hash> hashIterator = solidTips.descendingIterator();
        while (hashIterator.hasNext() && i < count) {
            result.add(hashIterator.next());
            i++;
        }
***
        if (result.isEmpty()) {
            return Collections.singletonList(Hash.NULL_HASH);
        }
***    
        return result;

(tested this and it works)

or would you see this as a "failure" of the populateSolidTips? (which should have added the genesis in this case?)

-- actually, it seems like a race condition: that the population happens after the first CC call. (populate does fill the tips w/ NULL_HASH)

alon-e commented 5 years ago

I'll write a PR that moves the population to getLatestSolidTips