2828import org .web3j .protocol .core .methods .request .EthFilter ;
2929import org .web3j .protocol .core .methods .response .EthLog ;
3030import org .web3j .protocol .core .methods .response .Log ;
31+ import org .web3j .utils .Numeric ;
3132
3233import java .math .BigInteger ;
3334import java .util .Arrays ;
@@ -178,8 +179,10 @@ public ChainReceipt getContributionBlock(final String chainTaskId,
178179 if (fromBlock > latestBlock ) {
179180 return ChainReceipt .builder ().build ();
180181 }
182+ // wallet needs to be encoded on 32 bytes instead of 20 bytes
183+ final String filterEncodedWallet = Numeric .toHexStringWithPrefixZeroPadded (Numeric .toBigInt (workerWallet ), 64 );
181184 final EthFilter ethFilter = createEthFilter (
182- fromBlock , latestBlock , LogTopic .TASK_CONTRIBUTE_EVENT , chainTaskId , workerWallet );
185+ fromBlock , latestBlock , LogTopic .TASK_CONTRIBUTE_EVENT , chainTaskId , filterEncodedWallet );
183186 return web3jService .getWeb3j ().ethGetLogs (ethFilter ).flowable ()
184187 .map (this ::createChainReceipt )
185188 .blockingFirst ();
@@ -206,8 +209,10 @@ public ChainReceipt getRevealBlock(final String chainTaskId,
206209 if (fromBlock > latestBlock ) {
207210 return ChainReceipt .builder ().build ();
208211 }
212+ // wallet needs to be encoded on 32 bytes instead of 20 bytes
213+ final String filterEncodedWallet = Numeric .toHexStringWithPrefixZeroPadded (Numeric .toBigInt (workerWallet ), 64 );
209214 final EthFilter ethFilter = createEthFilter (
210- fromBlock , latestBlock , LogTopic .TASK_REVEAL_EVENT , chainTaskId , workerWallet );
215+ fromBlock , latestBlock , LogTopic .TASK_REVEAL_EVENT , chainTaskId , filterEncodedWallet );
211216 return web3jService .getWeb3j ().ethGetLogs (ethFilter ).flowable ()
212217 .map (this ::createChainReceipt )
213218 .blockingFirst ();
0 commit comments