Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8d33886
feat: stop looking up the pegout index after the federations pending …
julianlen Oct 21, 2026
ae7a207
feat: stop looking up the pegout index after the federations pending …
julianlen Oct 21, 2026
f111535
test: cover releases created for vetiver registered within and after …
julianlen Oct 21, 2026
3a504d1
refactor: register svp test transactions after the grace period when …
julianlen Oct 21, 2026
5d08155
test: cover svp fund tx created for vetiver registered within and aft…
julianlen Oct 21, 2026
8205bd3
refactor: build grace period release transactions with the pegout and…
julianlen Oct 22, 2026
95878f4
refactor: test the federations pending btc utxos grace period through…
julianlen Oct 22, 2026
79338aa
refactor: reuse the svp fund transaction created for vetiver arrange …
julianlen Oct 22, 2026
f0ede5e
refactor: check every input when asserting a rejected release is not …
julianlen Oct 22, 2026
e4d9e20
test: cover releases not in the pegout index for vetiver and within t…
julianlen Oct 22, 2026
63b2bcd
refactor: share the rejected and refunded release assertion between r…
julianlen Oct 22, 2026
e7ae24c
test: cover pre-RSKIP643 pegout with change below minimum pegin value…
julianlen Oct 22, 2026
a576b2a
feat: added isIdentifiedByPegoutIndex
julianlen Oct 22, 2026
67fcdd3
fix: deleeted duplicated tests
julianlen Oct 22, 2026
19e7e70
fix: use the whole input value in the vetiver pegout without change t…
julianlen Oct 22, 2026
b3f37b0
fix: format
julianlen Oct 22, 2026
d463e72
refactor: made isIdentifiedByPegoutIndex simpler
julianlen Oct 22, 2026
51398c3
fix: use registerReleaseTransaction instead
julianlen Oct 22, 2026
a8dea24
changed BTC_BLOCK_WITH_RELEASE_WITHIN_GRACE_PERIOD_HEIGHT to HEIGHT_W…
julianlen Oct 22, 2026
1409e06
test: add forVetiver cases for pegout txs
julianlen Oct 22, 2026
8b41f7c
refactor: remove RSKIP643 pegout index grace period
julianlen Oct 23, 2026
7beb02e
refactor: remove btcHeightWhenFederationsPendingBtcUTXOsActivates bri…
julianlen Oct 23, 2026
3377eb2
fix: deleted unused imports
julianlen Oct 23, 2026
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
33 changes: 29 additions & 4 deletions rskj-core/src/main/java/co/rsk/peg/PegUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,24 @@ private PegUtils() { }
static PegTxType getTransactionTypeUsingPegoutIndex(
ActivationConfig.ForBlock activations,
BridgeStorageProvider provider,
BridgeConstants bridgeConstants,
Wallet liveFederationsWallet,
BtcTransaction btcTransaction
BtcTransaction btcTransaction,
long btcTransactionHeight
) {
if (!activations.isActive(ConsensusRule.RSKIP379)) {
throw new IllegalStateException("Can't call this method before RSKIP379 activation");
}

List<TransactionOutput> liveFederationOutputs = btcTransaction.getWalletOutputs(liveFederationsWallet);

Optional<Sha256Hash> inputSigHash = BitcoinUtils.getSigHashForPegoutIndex(btcTransaction);
if (inputSigHash.isPresent() && provider.hasPegoutTxSigHash(inputSigHash.get())){
if (isIdentifiedByPegoutIndex(
provider,
bridgeConstants,
activations,
btcTransaction,
btcTransactionHeight
)) {
return PegTxType.PEGOUT_OR_MIGRATION;
} else if (!liveFederationOutputs.isEmpty()){
return PegTxType.PEGIN;
Expand All @@ -53,6 +60,22 @@ static PegTxType getTransactionTypeUsingPegoutIndex(
}
}

private static boolean isIdentifiedByPegoutIndex(
BridgeStorageProvider provider,
BridgeConstants bridgeConstants,
ActivationConfig.ForBlock activations,
BtcTransaction btcTransaction,
long btcTransactionHeight
) {
// Once the grace period ends, releases are only identified by their federations pending btc utxos
if (isFederationsPendingBtcUTXOsEnabled(bridgeConstants, activations, btcTransactionHeight)) {
return false;
}
return BitcoinUtils.getSigHashForPegoutIndex(btcTransaction)
.map(provider::hasPegoutTxSigHash)
.orElse(false);
}

/**
* Checks if all utxos sent to the <b>fedWallet</b> are equal or above the minimum pegin value.
* If no utxo is sent to the <b>fedWallet </b>or there is at least 1 utxo sent to the <b>fedWallet</b> that is below minimum,
Expand Down Expand Up @@ -126,8 +149,10 @@ static PegTxType getTransactionType(
return getTransactionTypeUsingPegoutIndex(
activations,
provider,
bridgeConstants,
liveFederationsWallet,
btcTransaction
btcTransaction,
btcTransactionHeight
);
}

Expand Down
Loading
Loading