Skip to content

Commit

Permalink
UTXO: Make fields final.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Schildbach authored and ripcurlx committed Aug 23, 2021
1 parent 354b914 commit 0e0280f
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions core/src/main/java/org/bitcoinj/core/UTXO.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
* Useful when working with free standing outputs.
*/
public class UTXO {
private Coin value;
private Script script;
private Sha256Hash hash;
private long index;
private int height;
private boolean coinbase;
private String address;
private final Coin value;
private final Script script;
private final Sha256Hash hash;
private final long index;
private final int height;
private final boolean coinbase;
private final String address;

/**
* Creates a stored transaction output.
Expand All @@ -55,13 +55,7 @@ public UTXO(Sha256Hash hash,
int height,
boolean coinbase,
Script script) {
this.hash = hash;
this.index = index;
this.value = value;
this.height = height;
this.script = script;
this.coinbase = coinbase;
this.address = "";
this(hash, index, value, height, coinbase, script, "");
}

/**
Expand All @@ -81,7 +75,12 @@ public UTXO(Sha256Hash hash,
boolean coinbase,
Script script,
String address) {
this(hash, index, value, height, coinbase, script);
this.hash = hash;
this.index = index;
this.value = value;
this.height = height;
this.script = script;
this.coinbase = coinbase;
this.address = address;
}

Expand Down

0 comments on commit 0e0280f

Please sign in to comment.