Skip to content

Commit 54fc852

Browse files
committed
Add final keyword and add intermediate variable
1 parent 328ce6a commit 54fc852

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/main/java/com/iexec/blockchain/broker/BrokerService.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Optional<String> fireMatchOrders(
134134
WorkerpoolOrder workerpoolOrder,
135135
RequestOrder requestOrder) {
136136
try {
137-
TransactionReceipt receipt = iexecHubService.
137+
final TransactionReceipt receipt = iexecHubService.
138138
getHubContract()
139139
.matchOrders(
140140
appOrder.toHubContract(),
@@ -145,17 +145,18 @@ Optional<String> fireMatchOrders(
145145
log.info("block {}, hash {}, status {}", receipt.getBlockNumber(), receipt.getTransactionHash(), receipt.getStatus());
146146
log.info("logs count {}", receipt.getLogs().size());
147147

148-
String workerpoolAddress = Numeric.toHexStringWithPrefixZeroPadded(
148+
final String workerpoolAddress = Numeric.toHexStringWithPrefixZeroPadded(
149149
Numeric.toBigInt(workerpoolOrder.getWorkerpool()), 64);
150+
final List<String> expectedTopics = List.of(SCHEDULER_NOTICE, workerpoolAddress);
150151
List<String> events = receipt.getLogs().stream()
151-
.filter(log -> List.of(SCHEDULER_NOTICE, workerpoolAddress).equals(log.getTopics()))
152+
.filter(log -> expectedTopics.equals(log.getTopics()))
152153
.map(Log::getData)
153154
.collect(Collectors.toList());
154155
log.info("logs {}", events);
155156
if (events.size() != 1) {
156157
throw new IllegalStateException("A single deal should have been created, not " + events.size());
157158
}
158-
String dealId = events.get(0);
159+
final String dealId = events.get(0);
159160
log.info("Matched orders [chainDealId:{}, tx:{}]", dealId, receipt.getTransactionHash());
160161
return Optional.of(dealId);
161162
} catch (Exception e) {

0 commit comments

Comments
 (0)