3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-12 10:15:52 +00:00

TransactionOutput: Fix incomplete isMine() implementation.

This commit is contained in:
Andreas Schildbach 2019-02-01 16:10:07 +01:00
parent 492b3c7f8d
commit 01daaf5815

View File

@ -301,14 +301,14 @@ public class TransactionOutput extends ChildMessage {
public boolean isMine(TransactionBag transactionBag) { public boolean isMine(TransactionBag transactionBag) {
try { try {
Script script = getScriptPubKey(); Script script = getScriptPubKey();
if (ScriptPattern.isPayToPubKey(script)) { if (ScriptPattern.isPayToPubKey(script))
return transactionBag.isPubKeyMine(ScriptPattern.extractKeyFromPayToPubKey(script)); return transactionBag.isPubKeyMine(ScriptPattern.extractKeyFromPayToPubKey(script));
} if (ScriptPattern.isPayToScriptHash(script)) { else if (ScriptPattern.isPayToScriptHash(script))
return transactionBag.isPayToScriptHashMine(ScriptPattern.extractHashFromPayToScriptHash(script)); return transactionBag.isPayToScriptHashMine(ScriptPattern.extractHashFromPayToScriptHash(script));
} else { else if (ScriptPattern.isPayToPubKeyHash(script))
byte[] pubkeyHash = script.getPubKeyHash(); return transactionBag.isPubKeyHashMine(ScriptPattern.extractHashFromPayToPubKeyHash(script));
return transactionBag.isPubKeyHashMine(pubkeyHash); else
} return false;
} catch (ScriptException e) { } catch (ScriptException e) {
// Just means we didn't understand the output of this transaction: ignore it. // Just means we didn't understand the output of this transaction: ignore it.
log.debug("Could not parse tx {} output script: {}", parent != null ? parent.getHash() : "(no parent)", e.toString()); log.debug("Could not parse tx {} output script: {}", parent != null ? parent.getHash() : "(no parent)", e.toString());