mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-14 19:25:51 +00:00
ScriptPattern: Rename some matcher methods to the typical name of the matched scripts.
This commit is contained in:
parent
71a5b1b89f
commit
caf9e52940
@ -233,7 +233,7 @@ public class Script {
|
||||
* useful more exotic types of transaction, but today most payments are to addresses.
|
||||
*/
|
||||
public boolean isSentToRawPubKey() {
|
||||
return ScriptPattern.isSentToRawPubKey(chunks);
|
||||
return ScriptPattern.isPayToPubKey(chunks);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -243,7 +243,7 @@ public class Script {
|
||||
* way to make payments due to the short and recognizable base58 form addresses come in.
|
||||
*/
|
||||
public boolean isSentToAddress() {
|
||||
return ScriptPattern.isSentToAddress(chunks);
|
||||
return ScriptPattern.isPayToPubKeyHash(chunks);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,7 +27,7 @@ import static org.bitcoinj.script.ScriptOpCodes.*;
|
||||
* This is a Script pattern matcher with some typical script patterns
|
||||
*/
|
||||
public class ScriptPattern {
|
||||
public static boolean isSentToAddress(List<ScriptChunk> chunks) {
|
||||
public static boolean isPayToPubKeyHash(List<ScriptChunk> chunks) {
|
||||
return chunks.size() == 5 &&
|
||||
chunks.get(0).equalsOpCode(OP_DUP) &&
|
||||
chunks.get(1).equalsOpCode(OP_HASH160) &&
|
||||
@ -51,7 +51,7 @@ public class ScriptPattern {
|
||||
chunks.get(2).equalsOpCode(OP_EQUAL);
|
||||
}
|
||||
|
||||
public static boolean isSentToRawPubKey(List<ScriptChunk> chunks) {
|
||||
public static boolean isPayToPubKey(List<ScriptChunk> chunks) {
|
||||
return chunks.size() == 2 &&
|
||||
chunks.get(1).equalsOpCode(OP_CHECKSIG) &&
|
||||
!chunks.get(0).isOpCode() &&
|
||||
|
@ -31,7 +31,7 @@ public class ScriptPatternTest {
|
||||
|
||||
@Test
|
||||
public void testCommonScripts() {
|
||||
assertTrue(ScriptPattern.isSentToAddress(
|
||||
assertTrue(ScriptPattern.isPayToPubKeyHash(
|
||||
ScriptBuilder.createOutputScript(keys.get(0).toAddress(MainNetParams.get())).getChunks()
|
||||
));
|
||||
assertTrue(ScriptPattern.isPayToScriptHash(
|
||||
@ -40,7 +40,7 @@ public class ScriptPatternTest {
|
||||
assertTrue(ScriptPattern.isSentToMultisig(
|
||||
ScriptBuilder.createMultiSigOutputScript(2, keys).getChunks()
|
||||
));
|
||||
assertTrue(ScriptPattern.isSentToRawPubKey(
|
||||
assertTrue(ScriptPattern.isPayToPubKey(
|
||||
ScriptBuilder.createOutputScript(keys.get(0)).getChunks()
|
||||
));
|
||||
assertTrue(ScriptPattern.isSentToCltvPaymentChannel(
|
||||
|
Loading…
x
Reference in New Issue
Block a user