Skip to content

Commit

Permalink
Merge pull request #367 from rsksmart/6500-master-merge
Browse files Browse the repository at this point in the history
Merge 6.5.0.0 changes into master
  • Loading branch information
marcos-iov authored Dec 9, 2024
2 parents f680105 + 09d5de7 commit ab4d69a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
8 changes: 8 additions & 0 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@
<sha256 value="c717c468bfc91536f1dbc0d98d6116a8e7c49fbaff643ef8710e7505cc450878" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="co.rsk" name="rskj-core" version="6.5.0-ARROWHEAD">
<artifact name="rskj-core-6.5.0-ARROWHEAD.jar">
<sha256 value="7721f59632d9ff825b0bb23cf52fa3eff347852068a03d792ce18d0deae547ae" origin="Generated by Gradle"/>
</artifact>
<artifact name="rskj-core-6.5.0-ARROWHEAD.module">
<sha256 value="16283f4aebbf5b5b35c63f098d81fb0d2aeb5e9fc3be51128ab300333127077f" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="co.rsk.bitcoinj" name="bitcoinj-thin" version="0.14.4-rsk-16">
<artifact name="bitcoinj-thin-0.14.4-rsk-16.jar">
<sha256 value="53957d6941a882f7aa33188da3dadcf96f15fa2ffd62e9130937eb84e98f11a4" origin="Generated by Gradle"/>
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/co/rsk/federate/BtcToRskClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -329,22 +329,22 @@ private void validateCoinbaseInformation(CoinbaseInformation coinbaseInformation
throw new IllegalArgumentException(message);
}

Optional<co.rsk.bitcoinj.core.Sha256Hash> expectedWitnessCommitment = BitcoinUtils.findWitnessCommitment(coinbaseTransaction);
co.rsk.bitcoinj.core.Sha256Hash calculatedWitnessCommitment = co.rsk.bitcoinj.core.Sha256Hash.twiceOf(
witnessMerkleRoot.getReversedBytes(),
witnessReservedValue
);

BitcoinUtils.findWitnessCommitment(coinbaseTransaction)
.filter(commitment -> commitment.equals(calculatedWitnessCommitment))
.orElseThrow(() -> {
String message = String.format(
"Block %s with segwit peg-in tx %s generated an invalid witness merkle root",
coinbaseInformation.getBlockHash(),
coinbaseTransaction.getHash()
);
logger.error("[validateCoinbaseInformation] {}", message);
return new IllegalArgumentException(message);
});
if (expectedWitnessCommitment.isEmpty() || !expectedWitnessCommitment.get().equals(calculatedWitnessCommitment)) {
String message = String.format(
"Block %s with segwit peg-in tx %s generated an invalid witness commitment",
coinbaseInformation.getBlockHash(),
coinbaseTransaction.getHash()
);
logger.error("[validateCoinbaseInformation] {}", message);
throw new IllegalArgumentException(message);
}

logger.debug(
"[validateCoinbaseInformation] Block {} with segwit peg-in tx {} has a valid witness merkle root",
coinbaseInformation.getBlockHash(),
Expand Down
1 change: 0 additions & 1 deletion src/main/java/co/rsk/federate/FedNodeRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
import co.rsk.peg.btcLockSender.BtcLockSenderProvider;
import co.rsk.peg.pegininstructions.PeginInstructionsProvider;
import org.bitcoinj.core.Context;
import org.bouncycastle.util.encoders.Hex;
import org.ethereum.crypto.ECKey;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down

0 comments on commit ab4d69a

Please sign in to comment.