mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-24 06:47:54 +01:00
Make isCoinBase() equivalent to the reference one.
This commit is contained in:
parent
2aaa601293
commit
ca1466e628
2 changed files with 4 additions and 3 deletions
|
@ -518,7 +518,7 @@ public class Transaction extends ChildMessage implements Serializable {
|
|||
*/
|
||||
public boolean isCoinBase() {
|
||||
maybeParse();
|
||||
return inputs.get(0).isCoinBase();
|
||||
return inputs.size() == 1 && inputs.get(0).isCoinBase();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -59,7 +59,7 @@ public class TransactionInput extends ChildMessage implements Serializable {
|
|||
TransactionInput(NetworkParameters params, Transaction parentTransaction, byte[] scriptBytes) {
|
||||
super(params);
|
||||
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.parentTransaction = parentTransaction;
|
||||
|
||||
|
@ -148,7 +148,8 @@ public class TransactionInput extends ChildMessage implements Serializable {
|
|||
*/
|
||||
public boolean isCoinBase() {
|
||||
maybeParse();
|
||||
return outpoint.getHash().equals(Sha256Hash.ZERO_HASH);
|
||||
return outpoint.getHash().equals(Sha256Hash.ZERO_HASH) &&
|
||||
outpoint.getIndex() == NO_SEQUENCE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue