Inline (fake) constant to only method using it.

Due to cyclic dependencies (NetworkParameters vs. Coin) MAX_SATOSHIS
cannot be made a true constant.
This commit is contained in:
Carsten Otto
2015-07-05 14:26:04 +02:00
parent e148e9e052
commit e2571729a9

View File

@@ -82,10 +82,9 @@ public final class Coin implements Monetary, Comparable<Coin>, Serializable {
*/
public final long value;
private final long MAX_SATOSHIS = COIN_VALUE * NetworkParameters.MAX_COINS;
private Coin(final long satoshis) {
checkArgument(-MAX_SATOSHIS <= satoshis && satoshis <= MAX_SATOSHIS,
long maxSatoshis = COIN_VALUE * NetworkParameters.MAX_COINS;
checkArgument(-maxSatoshis <= satoshis && satoshis <= maxSatoshis,
"%s satoshis exceeds maximum possible quantity of Bitcoin.", satoshis);
this.value = satoshis;
}