3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-31 07:12:17 +00:00

Make isCoinBase() equivalent to the reference one.

This commit is contained in:
Matt Corallo 2012-07-11 02:39:57 +02:00 committed by Mike Hearn
parent 2aaa601293
commit ca1466e628
2 changed files with 4 additions and 3 deletions

View File

@ -518,7 +518,7 @@ public class Transaction extends ChildMessage implements Serializable {
*/ */
public boolean isCoinBase() { public boolean isCoinBase() {
maybeParse(); maybeParse();
return inputs.get(0).isCoinBase(); return inputs.size() == 1 && inputs.get(0).isCoinBase();
} }
/** /**

View File

@ -59,7 +59,7 @@ public class TransactionInput extends ChildMessage implements Serializable {
TransactionInput(NetworkParameters params, Transaction parentTransaction, byte[] scriptBytes) { TransactionInput(NetworkParameters params, Transaction parentTransaction, byte[] scriptBytes) {
super(params); super(params);
this.scriptBytes = scriptBytes; this.scriptBytes = scriptBytes;
this.outpoint = new TransactionOutPoint(params, -1, (Transaction)null); this.outpoint = new TransactionOutPoint(params, NO_SEQUENCE, (Transaction)null);
this.sequence = NO_SEQUENCE; this.sequence = NO_SEQUENCE;
this.parentTransaction = parentTransaction; this.parentTransaction = parentTransaction;
@ -148,7 +148,8 @@ public class TransactionInput extends ChildMessage implements Serializable {
*/ */
public boolean isCoinBase() { public boolean isCoinBase() {
maybeParse(); maybeParse();
return outpoint.getHash().equals(Sha256Hash.ZERO_HASH); return outpoint.getHash().equals(Sha256Hash.ZERO_HASH) &&
outpoint.getIndex() == NO_SEQUENCE;
} }
/** /**