mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2024-11-19 01:40:26 +01:00
LegacyAddressTest: move redeem-to-address test to ScriptBuilderTest
This commit is contained in:
parent
5db6a8fab5
commit
29b1f1a341
@ -22,8 +22,6 @@ import nl.jqno.equalsverifier.Warning;
|
||||
import org.bitcoinj.base.exceptions.AddressFormatException;
|
||||
import org.bitcoinj.base.internal.ByteUtils;
|
||||
import org.bitcoinj.base.internal.MockAltNetwork;
|
||||
import org.bitcoinj.script.ScriptBuilder;
|
||||
import org.bitcoinj.script.ScriptPattern;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@ -168,9 +166,6 @@ public class LegacyAddressTest {
|
||||
assertEquals("35b9vsyH1KoFT5a5KtrKusaCcPLkiSo1tU", a.toString());
|
||||
LegacyAddress b = LegacyAddress.fromScriptHash(TESTNET, ByteUtils.parseHex("18a0e827269b5211eb51a4af1b2fa69333efa722"));
|
||||
assertEquals("2MuVSxtfivPKJe93EC1Tb9UhJtGhsoWEHCe", b.toString());
|
||||
LegacyAddress c = LegacyAddress.fromScriptHash(MAINNET,
|
||||
ScriptPattern.extractHashFromP2SH(ScriptBuilder.createP2SHOutputScript(hex)));
|
||||
assertEquals("35b9vsyH1KoFT5a5KtrKusaCcPLkiSo1tU", c.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -16,8 +16,11 @@
|
||||
|
||||
package org.bitcoinj.script;
|
||||
|
||||
import org.bitcoinj.base.LegacyAddress;
|
||||
import org.bitcoinj.base.internal.ByteUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.bitcoinj.base.BitcoinNetwork.MAINNET;
|
||||
import static org.bitcoinj.script.ScriptOpCodes.OP_FALSE;
|
||||
import static org.bitcoinj.script.ScriptOpCodes.OP_TRUE;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
@ -120,4 +123,13 @@ public class ScriptBuilderTest {
|
||||
byte[] s = new ScriptBuilder().opFalse().build().program();
|
||||
assertArrayEquals(expected, s);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void p2shAddressTest() {
|
||||
// Test that we can convert a redeem script to an address
|
||||
byte[] redeemScriptHex = ByteUtils.parseHex("2ac4b0b501117cc8119c5797b519538d4942e90e");
|
||||
LegacyAddress c = LegacyAddress.fromScriptHash(MAINNET,
|
||||
ScriptPattern.extractHashFromP2SH(ScriptBuilder.createP2SHOutputScript(redeemScriptHex)));
|
||||
assertEquals("35b9vsyH1KoFT5a5KtrKusaCcPLkiSo1tU", c.toString());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user