Commit e2571729 authored by Carsten Otto's avatar Carsten Otto

Inline (fake) constant to only method using it.

Due to cyclic dependencies (NetworkParameters vs. Coin) MAX_SATOSHIS
cannot be made a true constant.
parent e148e9e0
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment