mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-07-30 19:41:24 +00:00
Replace tabs with spaces.
This commit is contained in:
committed by
Andreas Schildbach
parent
b3e33fea2a
commit
36c6c6e3af
@@ -77,7 +77,7 @@ public abstract class AbstractBitcoinNetParams extends NetworkParameters {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkDifficultyTransitions(final StoredBlock storedPrev, final Block nextBlock,
|
public void checkDifficultyTransitions(final StoredBlock storedPrev, final Block nextBlock,
|
||||||
final BlockStore blockStore) throws VerificationException, BlockStoreException {
|
final BlockStore blockStore) throws VerificationException, BlockStoreException {
|
||||||
final Block prev = storedPrev.getHeader();
|
final Block prev = storedPrev.getHeader();
|
||||||
|
|
||||||
// Is this supposed to be a difficulty transition point?
|
// Is this supposed to be a difficulty transition point?
|
||||||
|
@@ -107,19 +107,19 @@ public class TestNet3Params extends AbstractBitcoinNetParams {
|
|||||||
// There is an integer underflow bug in bitcoin-qt that means mindiff blocks are accepted when time
|
// There is an integer underflow bug in bitcoin-qt that means mindiff blocks are accepted when time
|
||||||
// goes backwards.
|
// goes backwards.
|
||||||
if (timeDelta >= 0 && timeDelta <= NetworkParameters.TARGET_SPACING * 2) {
|
if (timeDelta >= 0 && timeDelta <= NetworkParameters.TARGET_SPACING * 2) {
|
||||||
// Walk backwards until we find a block that doesn't have the easiest proof of work, then check
|
// Walk backwards until we find a block that doesn't have the easiest proof of work, then check
|
||||||
// that difficulty is equal to that one.
|
// that difficulty is equal to that one.
|
||||||
StoredBlock cursor = storedPrev;
|
StoredBlock cursor = storedPrev;
|
||||||
while (!cursor.getHeader().equals(getGenesisBlock()) &&
|
while (!cursor.getHeader().equals(getGenesisBlock()) &&
|
||||||
cursor.getHeight() % getInterval() != 0 &&
|
cursor.getHeight() % getInterval() != 0 &&
|
||||||
cursor.getHeader().getDifficultyTargetAsInteger().equals(getMaxTarget()))
|
cursor.getHeader().getDifficultyTargetAsInteger().equals(getMaxTarget()))
|
||||||
cursor = cursor.getPrev(blockStore);
|
cursor = cursor.getPrev(blockStore);
|
||||||
BigInteger cursorTarget = cursor.getHeader().getDifficultyTargetAsInteger();
|
BigInteger cursorTarget = cursor.getHeader().getDifficultyTargetAsInteger();
|
||||||
BigInteger newTarget = nextBlock.getDifficultyTargetAsInteger();
|
BigInteger newTarget = nextBlock.getDifficultyTargetAsInteger();
|
||||||
if (!cursorTarget.equals(newTarget))
|
if (!cursorTarget.equals(newTarget))
|
||||||
throw new VerificationException("Testnet block transition that is not allowed: " +
|
throw new VerificationException("Testnet block transition that is not allowed: " +
|
||||||
Long.toHexString(cursor.getHeader().getDifficultyTarget()) + " vs " +
|
Long.toHexString(cursor.getHeader().getDifficultyTarget()) + " vs " +
|
||||||
Long.toHexString(nextBlock.getDifficultyTarget()));
|
Long.toHexString(nextBlock.getDifficultyTarget()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
super.checkDifficultyTransitions(storedPrev, nextBlock, blockStore);
|
super.checkDifficultyTransitions(storedPrev, nextBlock, blockStore);
|
||||||
|
@@ -228,7 +228,7 @@ public abstract class PaymentChannelServerState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the client provides us with a new signature and wishes to increment total payment by size. +
|
* Called when the client provides us with a new signature and wishes to increment total payment by size.
|
||||||
* Verifies the provided signature and only updates values if everything checks out.
|
* Verifies the provided signature and only updates values if everything checks out.
|
||||||
* If the new refundSize is not the lowest we have seen, it is simply ignored.
|
* If the new refundSize is not the lowest we have seen, it is simply ignored.
|
||||||
*
|
*
|
||||||
|
@@ -332,7 +332,7 @@ public class ScriptBuilder {
|
|||||||
|
|
||||||
/** Create a program that satisfies an OP_CHECKMULTISIG program, using pre-encoded signatures. */
|
/** Create a program that satisfies an OP_CHECKMULTISIG program, using pre-encoded signatures. */
|
||||||
public static Script createMultiSigInputScriptBytes(List<byte[]> signatures) {
|
public static Script createMultiSigInputScriptBytes(List<byte[]> signatures) {
|
||||||
return createMultiSigInputScriptBytes(signatures, null);
|
return createMultiSigInputScriptBytes(signatures, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -366,7 +366,7 @@ public class ScriptBuilder {
|
|||||||
for (byte[] signature : signatures)
|
for (byte[] signature : signatures)
|
||||||
builder.data(signature);
|
builder.data(signature);
|
||||||
if (multisigProgramBytes!= null)
|
if (multisigProgramBytes!= null)
|
||||||
builder.data(multisigProgramBytes);
|
builder.data(multisigProgramBytes);
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -809,7 +809,7 @@ public abstract class BtcFormat extends Format {
|
|||||||
* locale.
|
* locale.
|
||||||
*/
|
*/
|
||||||
public static BtcFormat getCodeInstance(int minDecimals) {
|
public static BtcFormat getCodeInstance(int minDecimals) {
|
||||||
return getCodeInstance(defaultLocale(), minDecimals);
|
return getCodeInstance(defaultLocale(), minDecimals);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -835,7 +835,7 @@ public abstract class BtcFormat extends Format {
|
|||||||
* fractional satoshis.
|
* fractional satoshis.
|
||||||
*/
|
*/
|
||||||
public static BtcFormat getInstance(Locale locale, int minDecimals) {
|
public static BtcFormat getInstance(Locale locale, int minDecimals) {
|
||||||
return getCodeInstance(locale, minDecimals);
|
return getCodeInstance(locale, minDecimals);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -847,7 +847,7 @@ public abstract class BtcFormat extends Format {
|
|||||||
* fractional satoshis.
|
* fractional satoshis.
|
||||||
*/
|
*/
|
||||||
public static BtcFormat getCodeInstance(Locale locale, int minDecimals) {
|
public static BtcFormat getCodeInstance(Locale locale, int minDecimals) {
|
||||||
return getInstance(CODE, locale, minDecimals);
|
return getInstance(CODE, locale, minDecimals);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -856,7 +856,7 @@ public abstract class BtcFormat extends Format {
|
|||||||
* units using a currency symbol, for example, {@code "µ฿"}.
|
* units using a currency symbol, for example, {@code "µ฿"}.
|
||||||
*/
|
*/
|
||||||
public static BtcFormat getSymbolInstance(Locale locale) {
|
public static BtcFormat getSymbolInstance(Locale locale) {
|
||||||
return getInstance(SYMBOL, locale);
|
return getInstance(SYMBOL, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -868,7 +868,7 @@ public abstract class BtcFormat extends Format {
|
|||||||
* fractional satoshis.
|
* fractional satoshis.
|
||||||
*/
|
*/
|
||||||
public static BtcFormat getSymbolInstance(Locale locale, int fractionPlaces) {
|
public static BtcFormat getSymbolInstance(Locale locale, int fractionPlaces) {
|
||||||
return getInstance(SYMBOL, locale, fractionPlaces);
|
return getInstance(SYMBOL, locale, fractionPlaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -889,7 +889,7 @@ public abstract class BtcFormat extends Format {
|
|||||||
* parsing will be done according to the default locale.
|
* parsing will be done according to the default locale.
|
||||||
*/
|
*/
|
||||||
public static BtcFormat getInstance(Style style, int fractionPlaces) {
|
public static BtcFormat getInstance(Style style, int fractionPlaces) {
|
||||||
return getInstance(style, defaultLocale(), fractionPlaces);
|
return getInstance(style, defaultLocale(), fractionPlaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -902,7 +902,7 @@ public abstract class BtcFormat extends Format {
|
|||||||
* as necessary to avoid giving a place to fractional satoshis.
|
* as necessary to avoid giving a place to fractional satoshis.
|
||||||
*/
|
*/
|
||||||
public static BtcFormat getInstance(Style style, Locale locale) {
|
public static BtcFormat getInstance(Style style, Locale locale) {
|
||||||
return getInstance(style, locale, 2);
|
return getInstance(style, locale, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -918,7 +918,7 @@ public abstract class BtcFormat extends Format {
|
|||||||
* fractional satoshis.
|
* fractional satoshis.
|
||||||
*/
|
*/
|
||||||
public static BtcFormat getInstance(Style style, Locale locale, int fractionPlaces) {
|
public static BtcFormat getInstance(Style style, Locale locale, int fractionPlaces) {
|
||||||
return new BtcAutoFormat(locale, style, fractionPlaces);
|
return new BtcAutoFormat(locale, style, fractionPlaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1131,7 +1131,7 @@ public abstract class BtcFormat extends Format {
|
|||||||
AttributedCharacterIterator i = numberFormat.formatToCharacterIterator(units);
|
AttributedCharacterIterator i = numberFormat.formatToCharacterIterator(units);
|
||||||
numberFormat.setDecimalFormatSymbols(anteSigns);
|
numberFormat.setDecimalFormatSymbols(anteSigns);
|
||||||
setFormatterDigits(numberFormat, anteDigits.get(0), anteDigits.get(1));
|
setFormatterDigits(numberFormat, anteDigits.get(0), anteDigits.get(1));
|
||||||
return i;
|
return i;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1282,19 +1282,19 @@ public abstract class BtcFormat extends Format {
|
|||||||
* client is permitted to pass us, and return a BigInteger representing the
|
* client is permitted to pass us, and return a BigInteger representing the
|
||||||
* number of satoshis having the equivalent value. */
|
* number of satoshis having the equivalent value. */
|
||||||
private static BigInteger inSatoshis(Object qty) {
|
private static BigInteger inSatoshis(Object qty) {
|
||||||
BigInteger satoshis;
|
BigInteger satoshis;
|
||||||
// the value might be bitcoins or satoshis
|
// the value might be bitcoins or satoshis
|
||||||
if (qty instanceof Long || qty instanceof Integer)
|
if (qty instanceof Long || qty instanceof Integer)
|
||||||
satoshis = BigInteger.valueOf(((Number)qty).longValue());
|
satoshis = BigInteger.valueOf(((Number)qty).longValue());
|
||||||
else if (qty instanceof BigInteger)
|
else if (qty instanceof BigInteger)
|
||||||
satoshis = (BigInteger)qty;
|
satoshis = (BigInteger)qty;
|
||||||
else if (qty instanceof BigDecimal)
|
else if (qty instanceof BigDecimal)
|
||||||
satoshis = ((BigDecimal)qty).movePointRight(Coin.SMALLEST_UNIT_EXPONENT).
|
satoshis = ((BigDecimal)qty).movePointRight(Coin.SMALLEST_UNIT_EXPONENT).
|
||||||
setScale(0,BigDecimal.ROUND_HALF_UP).unscaledValue();
|
setScale(0,BigDecimal.ROUND_HALF_UP).unscaledValue();
|
||||||
else if (qty instanceof Coin)
|
else if (qty instanceof Coin)
|
||||||
satoshis = BigInteger.valueOf(((Coin)qty).value);
|
satoshis = BigInteger.valueOf(((Coin)qty).value);
|
||||||
else
|
else
|
||||||
throw new IllegalArgumentException("Cannot format a " + qty.getClass().getSimpleName() +
|
throw new IllegalArgumentException("Cannot format a " + qty.getClass().getSimpleName() +
|
||||||
" as a Bicoin value");
|
" as a Bicoin value");
|
||||||
return satoshis;
|
return satoshis;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user