Skip to content

Commit

Permalink
Add explanatory comment to migration and svp fund tx
Browse files Browse the repository at this point in the history
  • Loading branch information
julia-zack committed Jan 13, 2025
1 parent 7940238 commit cfffcbb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,9 @@ private Coin amountToMigrate(BtcTransaction migrationTransaction) {
amountToMigrate = amountToMigrate.add(input.getValue());
}

// since the retiring fed pays for the migrations fees, the actual amount
// being sent is different from the requested amount,
// that is the total amount from used inputs since there is no change output
return amountToMigrate;
}

Expand All @@ -1405,11 +1408,15 @@ private void settleSvpFundTransactionRelease(PegoutsWaitingForConfirmations pego

private Coin getSvpFundTxSentAmount(BtcTransaction svpFundTransaction) {
Coin svpFundTxSentAmount = Coin.ZERO;
for (int i = 0; i < svpFundTransaction.getOutputs().size() - 1; i ++) {
int changeOutputIndex = svpFundTransaction.getOutputs().size() - 1;
for (int i = 0; i < changeOutputIndex; i ++) {
TransactionOutput output = svpFundTransaction.getOutput(i);
svpFundTxSentAmount = svpFundTxSentAmount.add(output.getValue());
}

// since the active fed pays for the svp fund tx fees, the actual amount
// being sent is calculated as the addition of outputs value,
// not considering the change output
return svpFundTxSentAmount;
}

Expand Down

0 comments on commit cfffcbb

Please sign in to comment.