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

Dao improvements #1746

Merged
merged 20 commits into from Oct 4, 2018
Merged

Conversation

ManfredKarrer
Copy link
Member

No description provided.

As PB handles enums globally there must not be same entries in 2 diff.
enums. Therefore I postfixed with _OUTPUT 3 entries in TxOutputType.
- Remove unneeded isLastOutput
- Rename bsqOutputs to tempTxOutputs
- Rename commitTxOutputs to commitTxOutputsForValidTx
- Remove voteRevealInputState and replace with isVoteRevealInputInValid
in TxInputParser
- Rename optionalVerifiedOpReturnType to optionalOpReturnType
- Replace if checks with checkNotNull if case must not happen
- Remove unused isLastOutput param
- Inline handleOpReturnOutput code to processOpReturnOutput
- Remove class fields remainingInputValue and use a local var instead
- Rename getOptionalVerifiedOpReturnType to getOptionalOpReturnType
- Continue to refactor to make methods more testable
- Add isUnLockInputValid to TxInputParser
- Continue to refactor to make methods more testable
- Clean up
- Move unlockBlockHeight field from Tx to TxOutput
- Remove tempTx from TxOutputParser
- Renamings
- Add isOpReturnOutput method to TempTxOuput
- Add check for opReturn in processTxOutput
- Handle burntBondValue
- Check for TxOutputType.INVALID_OUTPUT in isTxInvalid
- Use commitUTXOCandidates for processGenesisTxOutput
- Cleanup
- Extract genesis parsing to GenesisTxParser
- Cleanups
Copy link
Member

@sqrrm sqrrm left a comment

Choose a reason for hiding this comment

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

utACK

Some good refactoring making it much clearer I think. As noticed you fixed all the issues found along the way.

core/src/main/java/bisq/core/dao/node/parser/TxParser.java Outdated Show resolved Hide resolved
@@ -52,7 +52,8 @@

private final BsqStateService bsqStateService;
@Getter
private TxInputParser.VoteRevealInputState voteRevealInputState = TxInputParser.VoteRevealInputState.UNKNOWN;
boolean isVoteRevealInputInValid = false;
Copy link
Member

Choose a reason for hiding this comment

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

This should be isVoteRevealInputValid

tempTxOutput.setTxOutputType(txOutputType);

optionalOpReturnType = getMappedOpReturnType(txOutputType);
// TODO: Do we really want to store the lockTime in another output as where we get it delivered?
Copy link
Member

Choose a reason for hiding this comment

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

Since the lockTime is referring to the lockTime of the first output I think it's correct. It just happens that the information has to be carried in the opreturn, and this is when it's parsed and assigned to the concerned txOutput.

* @param optionalOpReturnType If present, the OP_RETURN type of the transaction.
* @param tempTx The temporary transaction.
* @param optionalOpReturnType The optional OP_RETURN type of the transaction.
* @param hasBurntBSQ If the have been remaining value from the inputs which got not spent in outputs.
Copy link
Member

Choose a reason for hiding this comment

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

This comment is quite hard to understand.

@@ -293,7 +291,7 @@ private void processVoteReveal(int blockHeight, TempTx tempTx) {
}

// We must not use an `if else` here!
if (!isPhaseValid || txInputParser.isVoteRevealInputInValid()) {
if (!isPhaseValid || txInputParser.isVoteRevealInputValid()) {
Copy link
Member

Choose a reason for hiding this comment

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

I think this is now incorrect, it should be !txInputParser.isVoteRevealInputValid()

core/src/main/java/bisq/core/dao/state/blockchain/Tx.java Outdated Show resolved Hide resolved
@ManfredKarrer
Copy link
Member Author

Thanks for the review!

@ManfredKarrer ManfredKarrer merged commit f562ffa into bisq-network:master Oct 4, 2018
@ManfredKarrer ManfredKarrer deleted the DAO-improvements branch October 4, 2018 20:09
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.

None yet

2 participants