Skip to content

Commit d07bbb7

Browse files
authored
Merge pull request #481 from rsksmart/skip_old_unprocessable_pegout
Skip old unprocessable pegout when processing pegouts
2 parents 4f34485 + 38c01ec commit d07bbb7

File tree

2 files changed

+316
-30
lines changed

2 files changed

+316
-30
lines changed

src/main/java/co/rsk/federate/btcreleaseclient/BtcReleaseClient.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,10 @@ protected void processReleases(Set<Map.Entry<Keccak256, BtcTransaction>> pegouts
318318
Keccak256 pegoutCreationRskTxHash = pegout.getKey();
319319
BtcTransaction pegoutBtcTx = pegout.getValue();
320320

321+
if (pegoutIsUnprocessable(pegoutCreationRskTxHash)) {
322+
continue;
323+
}
324+
321325
tryGetReleaseInformation(version, pegoutCreationRskTxHash, pegoutBtcTx)
322326
.ifPresent(pegoutsReadyToSign::add);
323327
}
@@ -335,6 +339,17 @@ protected void processReleases(Set<Map.Entry<Keccak256, BtcTransaction>> pegouts
335339
logger.trace("[processReleases] Finished processing pegouts");
336340
}
337341

342+
private boolean pegoutIsUnprocessable(Keccak256 pegoutCreationRskTxHash) {
343+
boolean networkIsTestnet = bridgeConstants.getBtcParams().getId()
344+
.equals(co.rsk.bitcoinj.core.NetworkParameters.ID_TESTNET);
345+
// there is a very old pegout that remains unprocessed.
346+
// since the federation changed from that time to now, it is unprocessable,
347+
// so we should not keep trying processing it
348+
Keccak256 unprocessablePegoutRskTxCreationHash =
349+
new Keccak256("86c6739feeb9279d8c7cd85bc6732cb818c3a9d54b55a070adfe1d31ba10f4e5");
350+
return networkIsTestnet && pegoutCreationRskTxHash.equals(unprocessablePegoutRskTxCreationHash);
351+
}
352+
338353
protected Optional<ReleaseCreationInformation> tryGetReleaseInformation(
339354
int signerVersion,
340355
Keccak256 pegoutCreationRskTxHash,

0 commit comments

Comments
 (0)