Skip to content

Commit

Permalink
Update view on activation with block at current chain height
Browse files Browse the repository at this point in the history
  • Loading branch information
ripcurlx committed Feb 12, 2019
1 parent 14d5330 commit 277084c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 9 additions & 0 deletions core/src/main/java/bisq/core/dao/DaoFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import bisq.core.dao.state.DaoStateListener;
import bisq.core.dao.state.DaoStateService;
import bisq.core.dao.state.DaoStateStorageService;
import bisq.core.dao.state.model.blockchain.Block;
import bisq.core.dao.state.model.blockchain.Tx;
import bisq.core.dao.state.model.blockchain.TxOutput;
import bisq.core.dao.state.model.blockchain.TxOutputKey;
Expand Down Expand Up @@ -484,6 +485,14 @@ public int getChainHeight() {
return daoStateService.getChainHeight();
}

public Optional<Block> getBlockAtChainHeight() {
return getBlockAtHeight(getChainHeight());
}

public Optional<Block> getBlockAtHeight(int chainHeight) {
return daoStateService.getBlockAtHeight(chainHeight);
}


///////////////////////////////////////////////////////////////////////////////////////////
// Use case: Bonding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicBoolean;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -199,7 +200,10 @@ protected void activate() {
if (makeProposalButton != null)
setMakeProposalButtonHandler();

onNewBlockHeight(daoFacade.getChainHeight());
Optional<Block> blockAtChainHeight = daoFacade.getBlockAtChainHeight();

if (blockAtChainHeight.isPresent())
onParseTxsCompleteAfterBatchProcessing(blockAtChainHeight.get());
}

@Override
Expand Down

0 comments on commit 277084c

Please sign in to comment.