Remove direct references to stateService in desktop

This commit is contained in:
sqrrm 2018-07-14 18:57:23 +02:00
parent 9f01e9e4e0
commit 09b6202d0d
No known key found for this signature in database
GPG key ID: 45235F9EF87089EC
3 changed files with 3 additions and 17 deletions

View file

@ -25,7 +25,6 @@ import bisq.core.btc.listeners.TxConfidenceListener;
import bisq.core.btc.wallet.BsqWalletService;
import bisq.core.btc.wallet.BtcWalletService;
import bisq.core.dao.DaoFacade;
import bisq.core.dao.state.StateService;
import bisq.core.dao.state.blockchain.TxOutput;
import bisq.core.dao.state.blockchain.TxType;
import bisq.core.locale.Res;
@ -51,9 +50,6 @@ class LockupTxListItem {
private final BtcWalletService btcWalletService;
private final DaoFacade daoFacade;
//TODO SQ stateService should not be used outside in desktop
private final StateService stateService;
private final BsqFormatter bsqFormatter;
private final Date date;
private final String txId;
@ -71,14 +67,12 @@ class LockupTxListItem {
BsqWalletService bsqWalletService,
BtcWalletService btcWalletService,
DaoFacade daoFacade,
StateService stateService,
Date date,
BsqFormatter bsqFormatter) {
this.transaction = transaction;
this.bsqWalletService = bsqWalletService;
this.btcWalletService = btcWalletService;
this.daoFacade = daoFacade;
this.stateService = stateService;
this.date = date;
this.bsqFormatter = bsqFormatter;
@ -89,8 +83,7 @@ class LockupTxListItem {
checkNotNull(transaction, "transaction must not be null as we only have list items from transactions " +
"which are available in the wallet");
//TODO SQ use daoFacade
stateService.getLockupTxOutput(transaction.getHashAsString())
daoFacade.getLockupTxOutput(transaction.getHashAsString())
.ifPresent(out -> amount = Coin.valueOf(out.getValue()));
Optional<Integer> opLockTime = daoFacade.getLockTime(transaction.getHashAsString());
@ -138,7 +131,7 @@ class LockupTxListItem {
public boolean isSpent() {
Optional<TxOutput> optionalTxOutput = daoFacade.getLockupTxOutput(txId);
return optionalTxOutput.map(txOutput -> !stateService.isUnspent(txOutput.getKey()))
return optionalTxOutput.map(txOutput -> !daoFacade.isUnspent(txOutput.getKey()))
.orElse(true);
}

View file

@ -36,7 +36,6 @@ import bisq.core.btc.wallet.BtcWalletService;
import bisq.core.btc.wallet.WalletsSetup;
import bisq.core.dao.DaoFacade;
import bisq.core.dao.state.BlockListener;
import bisq.core.dao.state.StateService;
import bisq.core.dao.state.blockchain.Block;
import bisq.core.dao.state.blockchain.TxOutput;
import bisq.core.dao.state.blockchain.TxType;
@ -92,9 +91,6 @@ public class UnlockView extends ActivatableView<GridPane, Void> implements BsqBa
private final DaoFacade daoFacade;
private final Preferences preferences;
//TODO SQ stateService should not be used outside in desktop
private final StateService stateService;
private final WalletsSetup walletsSetup;
private final P2PService p2PService;
private final Navigation navigation;
@ -122,7 +118,6 @@ public class UnlockView extends ActivatableView<GridPane, Void> implements BsqBa
BsqValidator bsqValidator,
DaoFacade daoFacade,
Preferences preferences,
StateService stateService,
WalletsSetup walletsSetup,
P2PService p2PService,
Navigation navigation) {
@ -133,7 +128,6 @@ public class UnlockView extends ActivatableView<GridPane, Void> implements BsqBa
this.bsqValidator = bsqValidator;
this.daoFacade = daoFacade;
this.preferences = preferences;
this.stateService = stateService;
this.walletsSetup = walletsSetup;
this.p2PService = p2PService;
this.navigation = navigation;
@ -415,7 +409,6 @@ public class UnlockView extends ActivatableView<GridPane, Void> implements BsqBa
bsqWalletService,
btcWalletService,
daoFacade,
stateService,
transaction.getUpdateTime(),
bsqFormatter);
})

View file

@ -50,7 +50,7 @@ import static bisq.desktop.util.FormBuilder.addTitledGroupBg;
// We use here ChainHeightListener because we are interested in period changes not in the result of a completed
// block. The event from the ChainHeightListener is sent before parsing starts.
// The event from the StateService.Listener would notify after parsing a new block.
// The event from the ChainHeightListener would notify after parsing a new block.
@FxmlView
public class ProposalDashboardView extends ActivatableView<GridPane, Void> implements ChainHeightListener {
private final DaoFacade daoFacade;