Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TipsManager can have iterator removed #1

Open
GalRogozinski opened this issue Jan 17, 2018 · 0 comments
Open

TipsManager can have iterator removed #1

GalRogozinski opened this issue Jan 17, 2018 · 0 comments

Comments

@GalRogozinski
Copy link
Owner

GalRogozinski commented Jan 17, 2018

It tips manager class line 233:

 if(tipSet.size() == 0) {
                log.info("Reason to stop: TransactionViewModel is a tip");
                messageQ.publish("rtst %s", tip);
                break;
            } else if (tipSet.size() == 1) {
                Iterator<Hash> hashIterator = tipSet.iterator();
                if(hashIterator.hasNext()) {
                    tip = hashIterator.next();
                } else {
                    tip = null;
                }

There is no need for the hashIterator as you can simply access the first element in the set.

GalRogozinski pushed a commit that referenced this issue Mar 22, 2018
…de some minor edits with regards to layout

(1) Made Hash thread-safe without needing full synchronization.

All access to `bytes`, `trits` and `hashcode` done via a null check against an inner class object that is instantiated in a synchronized block with a double check. `ByteSafe` and `TritSafe` are inner classes and the data hidden in them is not available until the classes are fully instantiated (classloading ensures this).

(2) #1 fixes the race condition to `hashcode()` and `equals()` and `bytes()` that was proven to be happening and might also have cause the FIFO cache overrun.

(3) Fixed `compareTo` to do an identity check and not need to make a new `Hash` every time - because Hash extends Indexable and the the indexible provided could already be a Hash.

(4) Commented on bounds check. This is easy to fix but so many tests are abusing it and they won't pass until the tests are also fixed.

(5) Added a null check in `fullread' because the RocksDB does provide null byte[] to read methods sometimes and they can be safely passed over.

(6) Added a 2nd time `read` persistence check. The class should be effectively immutable (not possible) but at least check to see if it has already been initialized and reject a second initialization.

All tests pass.
Live run passed.
GalRogozinski pushed a commit that referenced this issue Jul 26, 2018
introduce isSnapshot flag on transactions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant