diff --git a/build.gradle b/build.gradle
index 1612e5b5..89efa8f1 100644
--- a/build.gradle
+++ b/build.gradle
@@ -62,7 +62,7 @@ tasks.withType(AbstractArchiveTask) {
ext {
bitcoinjcoreVersion = '0.15.6-rsk-3'
- bitcoinjVersion = '0.14.4-rsk-15'
+ bitcoinjVersion = '0.14.4-rsk-16-SNAPSHOT'
commonsLang3Version = '3.12.0'
commonsIoVersion = '2.11.0'
slf4jVersion = '1.7.36'
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index 891438c1..57de6457 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -69,14 +69,6 @@
-
-
-
-
-
-
-
-
diff --git a/src/main/java/co/rsk/federate/btcreleaseclient/BtcReleaseClient.java b/src/main/java/co/rsk/federate/btcreleaseclient/BtcReleaseClient.java
index 6ca154b3..154cb8b1 100644
--- a/src/main/java/co/rsk/federate/btcreleaseclient/BtcReleaseClient.java
+++ b/src/main/java/co/rsk/federate/btcreleaseclient/BtcReleaseClient.java
@@ -6,6 +6,7 @@
import co.rsk.bitcoinj.script.RedeemScriptParser;
import co.rsk.bitcoinj.script.RedeemScriptParserFactory;
import co.rsk.bitcoinj.script.Script;
+import co.rsk.bitcoinj.script.ScriptBuilder;
import co.rsk.bitcoinj.script.ScriptChunk;
import co.rsk.bitcoinj.wallet.RedeemData;
import co.rsk.peg.constants.BridgeConstants;
@@ -479,8 +480,9 @@ protected void removeSignaturesFromTransaction(BtcTransaction pegoutBtcTx, Feder
}
protected Script extractStandardRedeemScript(Script redeemScript) {
- RedeemScriptParser parser = RedeemScriptParserFactory.get(redeemScript.getChunks());
- return parser.extractStandardRedeemScript();
+ RedeemScriptParser redeemScriptParser = RedeemScriptParserFactory.get(redeemScript.getChunks());
+ List defaultRedeemScriptChunks = redeemScriptParser.extractStandardRedeemScriptChunks();
+ return new ScriptBuilder().addChunks(defaultRedeemScriptChunks).build();
}
private Script extractDefaultRedeemScript(Federation federation) {
@@ -505,7 +507,6 @@ protected Federation getSpendingFederation(BtcTransaction btcTx) {
List spendingFedFilter = observedFederations.stream()
.filter(f -> (extractDefaultRedeemScript(f)).equals(redeemScript)).collect(Collectors.toList());
-
return spendingFedFilter.get(0);
}
diff --git a/src/test/java/co/rsk/federate/btcreleaseclient/BtcReleaseClientTest.java b/src/test/java/co/rsk/federate/btcreleaseclient/BtcReleaseClientTest.java
index 5ecb22ba..d8d1603a 100644
--- a/src/test/java/co/rsk/federate/btcreleaseclient/BtcReleaseClientTest.java
+++ b/src/test/java/co/rsk/federate/btcreleaseclient/BtcReleaseClientTest.java
@@ -29,10 +29,10 @@
import co.rsk.bitcoinj.core.TransactionInput;
import co.rsk.bitcoinj.crypto.TransactionSignature;
import co.rsk.bitcoinj.params.RegTestParams;
-import co.rsk.bitcoinj.script.FastBridgeRedeemScriptParser;
import co.rsk.bitcoinj.script.Script;
import co.rsk.bitcoinj.script.ScriptBuilder;
import co.rsk.bitcoinj.script.ScriptChunk;
+import co.rsk.peg.bitcoin.FlyoverRedeemScriptBuilderImpl;
import co.rsk.peg.constants.BridgeConstants;
import co.rsk.crypto.Keccak256;
import co.rsk.federate.FederatorSupport;
@@ -820,13 +820,16 @@ void validateTxCanBeSigned_fast_bridge_ok() throws Exception {
Federation federation = TestUtils.createFederation(params, 1);
// Create fast bridge redeem script
- Script fastBridgeRedeemScript = FastBridgeRedeemScriptParser.createMultiSigFastBridgeRedeemScript(
- federation.getRedeemScript(),
- Sha256Hash.wrap(TestUtils.createHash(1).getBytes())
+
+ Keccak256 flyoverDerivationHash = createHash(1);
+
+ Script flyoverRedeemScript = FlyoverRedeemScriptBuilderImpl.builder().of(
+ flyoverDerivationHash,
+ federation.getRedeemScript()
);
// Create a tx from the Fed to a random btc address
- BtcTransaction releaseTx = createReleaseTxAndAddInput(federation, fastBridgeRedeemScript);
+ BtcTransaction releaseTx = createReleaseTxAndAddInput(federation, flyoverRedeemScript);
BtcECKey fed1Key = federation.getBtcPublicKeys().get(0);
ECPublicKey signerPublicKey = new ECPublicKey(fed1Key.getPubKey());
@@ -1020,13 +1023,14 @@ void getRedeemScriptFromInput_standard_redeem_script() {
@Test
void extractStandardRedeemScript_fast_bridge_redeem_script() {
Federation federation = TestUtils.createFederation(params, 1);
- Script fastBridgeRedeemScript =
- FastBridgeRedeemScriptParser.createMultiSigFastBridgeRedeemScript(
- federation.getRedeemScript(),
- Sha256Hash.of(TestUtils.createHash(1).getBytes())
- );
- test_extractStandardRedeemScript(federation.getRedeemScript(), fastBridgeRedeemScript);
+ Keccak256 flyoverDerivationHash = createHash(1);
+ Script flyoverRedeemScript = FlyoverRedeemScriptBuilderImpl.builder().of(
+ flyoverDerivationHash,
+ federation.getRedeemScript()
+ );
+
+ test_extractStandardRedeemScript(federation.getRedeemScript(), flyoverRedeemScript);
}
@Test
@@ -1112,7 +1116,7 @@ private void test_extractStandardRedeemScript(
);
}
- private void test_getRedeemScriptFromInput(boolean isFastBridgeRedeemScript) {
+ private void test_getRedeemScriptFromInput(boolean isFlyoverRedeemScript) {
BtcReleaseClient client = createBtcClient();
BtcECKey ecKey1 = BtcECKey.fromPrivate(BigInteger.valueOf(100));
@@ -1124,10 +1128,11 @@ private void test_getRedeemScriptFromInput(boolean isFastBridgeRedeemScript) {
Script federationRedeemScript = federation.getRedeemScript();
Script inputScript;
- if (isFastBridgeRedeemScript) {
- federationRedeemScript = FastBridgeRedeemScriptParser.createMultiSigFastBridgeRedeemScript(
- federationRedeemScript,
- Sha256Hash.of(new byte[]{1})
+ if (isFlyoverRedeemScript) {
+ Keccak256 flyoverDerivationHash = createHash(1);
+ federationRedeemScript = FlyoverRedeemScriptBuilderImpl.builder().of(
+ flyoverDerivationHash,
+ federation.getRedeemScript()
);
}
inputScript = federation.getP2SHScript().createEmptyInputScript(