From 0ef70cd7a04fc5f4a4d19421e4c7181eddee2a4f Mon Sep 17 00:00:00 2001 From: Chi Nul Date: Sat, 11 Aug 2018 13:24:11 +0200 Subject: [PATCH] Simplify ParsingModel constructor to take TempTx --- src/main/java/bisq/core/dao/node/parser/ParsingModel.java | 7 ++----- src/main/java/bisq/core/dao/node/parser/TxParser.java | 5 ++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main/java/bisq/core/dao/node/parser/ParsingModel.java b/src/main/java/bisq/core/dao/node/parser/ParsingModel.java index 7ae50c2c..5f7734ae 100644 --- a/src/main/java/bisq/core/dao/node/parser/ParsingModel.java +++ b/src/main/java/bisq/core/dao/node/parser/ParsingModel.java @@ -80,11 +80,8 @@ enum BlindVoteOutputState { @Nullable private OpReturnType verifiedOpReturnType; - ParsingModel() { - } - - ParsingModel(long availableInputValue) { - this.availableInputValue = availableInputValue; + ParsingModel(TempTx tx) { + this.tx = tx; } public void addToInputValue(long value) { diff --git a/src/main/java/bisq/core/dao/node/parser/TxParser.java b/src/main/java/bisq/core/dao/node/parser/TxParser.java index fb2fb0fe..c490c149 100644 --- a/src/main/java/bisq/core/dao/node/parser/TxParser.java +++ b/src/main/java/bisq/core/dao/node/parser/TxParser.java @@ -78,11 +78,10 @@ public Optional findTx(RawTx rawTx, String genesisTxId, int genesisBlockHeig // If it is not a genesis tx we continue to parse to see if it is a valid BSQ tx. int blockHeight = rawTx.getBlockHeight(); - ParsingModel parsingModel = new ParsingModel(); - TempTx tempTx = TempTx.fromRawTx(rawTx); // We could pass tx also to the sub validators but as long we have not refactored the validators to pure // functions lets use the parsingModel. - parsingModel.setTx(tempTx); + TempTx tempTx = TempTx.fromRawTx(rawTx); + ParsingModel parsingModel = new ParsingModel(tempTx); for (int inputIndex = 0; inputIndex < tempTx.getTxInputs().size(); inputIndex++) { TxInput input = tempTx.getTxInputs().get(inputIndex);