Fix bug with using wrong collection which held only one bond per hash

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
This commit is contained in:
HenrikJannsen 2024-06-30 18:28:32 +07:00
parent 039d778eca
commit 7b85bc5876
No known key found for this signature in database
GPG Key ID: 02AA2BAE387C8307
2 changed files with 4 additions and 2 deletions

View File

@ -99,7 +99,7 @@ public class BondedReputationRepository extends BondRepository<BondedReputation,
bonds.setAll(bondByUidMap.values());
}
private Stream<BondedReputation> getBondedReputationStream() {
public Stream<BondedReputation> getBondedReputationStream() {
return getLockupTxOutputsForBondedReputation()
.map(lockupTxOutput -> {
String lockupTxId = lockupTxOutput.getTxId();

View File

@ -17,6 +17,7 @@
package bisq.restapi.endpoints;
import bisq.core.dao.governance.bond.reputation.BondedReputation;
import bisq.core.dao.governance.bond.reputation.BondedReputationRepository;
import bisq.core.dao.state.DaoStateService;
import bisq.core.dao.state.model.blockchain.Tx;
@ -80,7 +81,8 @@ public class BondedReputationApi {
@PathParam("block-height")
int fromBlockHeight) {
// We only consider lock time with at least 50 000 blocks as valid
List<BondedReputationDto> result = bondedReputationRepository.getActiveBonds().stream()
List<BondedReputationDto> result = bondedReputationRepository.getBondedReputationStream()
.filter(BondedReputation::isActive)
.filter(bondedReputation -> bondedReputation.getLockTime() >= 50_000)
.map(bondedReputation -> {
Optional<Tx> optionalTx = daoStateService.getTx(bondedReputation.getLockupTxId());