Only show accepted bonded roles in bond view.

Fixes #3271

Replaces https://github.com/bisq-network/bisq/pull/3320
This commit is contained in:
chimp1984 2019-11-24 13:10:10 -05:00
parent d12a4049ad
commit ff10f7cf3f
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3
3 changed files with 13 additions and 1 deletions

View File

@ -294,6 +294,10 @@ public class DaoFacade implements DaoSetupService {
return bondedRolesRepository.getBonds();
}
public List<BondedRole> getAcceptedBondedRoles() {
return bondedRolesRepository.getAcceptedBonds();
}
// Show fee
public Coin getProposalFee(int chainHeight) {
return ProposalConsensus.getFee(daoStateService, chainHeight);

View File

@ -32,6 +32,7 @@ import org.bitcoinj.core.Transaction;
import javax.inject.Inject;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@ -74,6 +75,13 @@ public class BondedRolesRepository extends BondRepository<BondedRole, Role> {
}
public List<BondedRole> getAcceptedBonds() {
return bonds.stream()
.filter(bondedRole -> getAcceptedBondedRoleProposal(bondedRole.getBondedAsset()).isPresent())
.collect(Collectors.toList());
}
///////////////////////////////////////////////////////////////////////////////////////////
// Protected
///////////////////////////////////////////////////////////////////////////////////////////

View File

@ -120,7 +120,7 @@ public class RolesView extends ActivatableView<GridPane, Void> {
///////////////////////////////////////////////////////////////////////////////////////////
private void updateList() {
observableList.setAll(daoFacade.getBondedRoles().stream()
observableList.setAll(daoFacade.getAcceptedBondedRoles().stream()
.map(bond -> new RolesListItem(bond, daoFacade))
.sorted(Comparator.comparing(RolesListItem::getLockupDate).reversed())
.collect(Collectors.toList()));