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

Feature events api #984

Merged
merged 6 commits into from
Jan 8, 2018
Merged

Feature events api #984

merged 6 commits into from
Jan 8, 2018

Conversation

zilm13
Copy link
Collaborator

@zilm13 zilm13 commented Dec 22, 2017

@mkalinin please take a look
Added events api + block replay
also removed obsolete networks settings

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 3df1ba3 on feature-events-api into ** on develop**.

logger.info("Replaying blocks from " + firstBlock + ", current best block: " + lastBlock);
int cnt = 0;
long num = firstBlock;
while(true) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while (!replayComplete) is better if it does not break the logic (as I can see it does not)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good

replayComplete = true;
break;
} else {
long newLastBlock = blockStore.getMaxNumber() - 192;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is 192 a magic number? why exactly 192 but not the other one?

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 3ef8f29 on feature-events-api into ** on develop**.

protected PendingStateImpl pendingState;

// txHash => PendingEvent
protected Map<ByteArrayWrapper, PendingEvent> pendings = new LinkedHashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe wrap it by ByteArrayMap for convenience?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, didn't know about it.

}
}

if (blockSummary.getTotalDifficulty().compareTo(lastTotDiff) > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it a better idea to supply BlockSummary with ImportStatus to indicate whether imported block is best or not. This small feature might be useful in many other places and save us from keeping this redundant code and data structures

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, but I'd rather put this logic in BlockSummary, because ImportState couldn't be always kept in BlockSummary, as summary may be null. I'll push this approach and we could discuss it, if it doesn't look ok.

int txCount = 0; // several transactions are possible withing a single Ethereum Tx
List<EventData> matchedTxs = new ArrayList<>();
for (LogInfo logInfo : receipt.getLogInfoList()) {
if (contractAddressFilter.matchBloom(logInfo.getBloom()) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current implementation doesn't allow user to instantiate a listener which does topics filtering out of the box. I think it worth to be extended with that feature.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we need such kind of low-level listener in addition to parsed events listener?

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 1c3e173 on feature-events-api into ** on develop**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 673f7e3 on feature-events-api into ** on develop**.

@mkalinin mkalinin merged commit 395d0a4 into develop Jan 8, 2018
@mkalinin mkalinin deleted the feature-events-api branch January 8, 2018 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants