Skip to content

Commit

Permalink
Update registerBtcTransaction to consider SVP transaction types
Browse files Browse the repository at this point in the history
  • Loading branch information
marcos-iov committed Nov 21, 2024
1 parent f6cccd2 commit 3a01401
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,6 @@ public void registerBtcTransaction(
throw new RegisterBtcTransactionException("Transaction already processed");
}

if (isSvpOngoing() && isTheSvpSpendTransaction(btcTx)) {
registerSvpSpendTransaction(btcTx);
return;
}

FederationContext federationContext = federationSupport.getFederationContext();
PegTxType pegTxType = PegUtils.getTransactionType(
activations,
Expand All @@ -418,21 +413,28 @@ public void registerBtcTransaction(
);

switch (pegTxType) {
case PEGIN:
case PEGIN -> {
logger.debug("[registerBtcTransaction] This is a peg-in tx {}", btcTx.getHash());
processPegIn(btcTx, rskTxHash, height);
break;
case PEGOUT_OR_MIGRATION:
}
case PEGOUT_OR_MIGRATION -> {
logger.debug("[registerBtcTransaction] This is a peg-out or migration tx {}", btcTx.getHash());
processPegoutOrMigration(btcTx);
if (isSvpOngoing() && isTheSvpFundTransaction(btcTx)) {
updateSvpFundTransactionValues(btcTx);
}
break;
default:
}
case SVP_FUND_TX -> {
logger.debug("[registerBtcTransaction] This is an svp fund tx {}", btcTx.getHash());
processPegoutOrMigration(btcTx); // Need to register the change UTXO
updateSvpFundTransactionValues(btcTx);
}
case SVP_SPEND_TX -> {
logger.debug("[registerBtcTransaction] This is an svp spend tx {}", btcTx.getHash());
registerSvpSpendTransaction(btcTx);
}
default -> {
String message = String.format("This is not a peg-in, a peg-out nor a migration tx %s", btcTx.getHash());
logger.warn("[registerBtcTransaction][rsk tx {}] {}", rskTxHash, message);
panicProcessor.panic("btclock", message);
}
}
} catch (RegisterBtcTransactionException e) {
logger.warn(
Expand Down

0 comments on commit 3a01401

Please sign in to comment.