Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/main/java/com/iexec/core/chain/IexecHubService.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.web3j.protocol.core.methods.request.EthFilter;
import org.web3j.protocol.core.methods.response.EthLog;
import org.web3j.protocol.core.methods.response.Log;
import org.web3j.utils.Numeric;

import java.math.BigInteger;
import java.util.Arrays;
Expand Down Expand Up @@ -178,8 +179,10 @@ public ChainReceipt getContributionBlock(final String chainTaskId,
if (fromBlock > latestBlock) {
return ChainReceipt.builder().build();
}
// wallet needs to be encoded on 32 bytes instead of 20 bytes
final String filterEncodedWallet = Numeric.toHexStringWithPrefixZeroPadded(Numeric.toBigInt(workerWallet), 64);
final EthFilter ethFilter = createEthFilter(
fromBlock, latestBlock, LogTopic.TASK_CONTRIBUTE_EVENT, chainTaskId, workerWallet);
fromBlock, latestBlock, LogTopic.TASK_CONTRIBUTE_EVENT, chainTaskId, filterEncodedWallet);
return web3jService.getWeb3j().ethGetLogs(ethFilter).flowable()
.map(this::createChainReceipt)
.blockingFirst();
Expand All @@ -206,8 +209,10 @@ public ChainReceipt getRevealBlock(final String chainTaskId,
if (fromBlock > latestBlock) {
return ChainReceipt.builder().build();
}
// wallet needs to be encoded on 32 bytes instead of 20 bytes
final String filterEncodedWallet = Numeric.toHexStringWithPrefixZeroPadded(Numeric.toBigInt(workerWallet), 64);
final EthFilter ethFilter = createEthFilter(
fromBlock, latestBlock, LogTopic.TASK_REVEAL_EVENT, chainTaskId, workerWallet);
fromBlock, latestBlock, LogTopic.TASK_REVEAL_EVENT, chainTaskId, filterEncodedWallet);
return web3jService.getWeb3j().ethGetLogs(ethFilter).flowable()
.map(this::createChainReceipt)
.blockingFirst();
Expand Down