mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-07-30 03:21:23 +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
|
||||
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();
|
||||
|
||||
// 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
|
||||
// goes backwards.
|
||||
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
|
||||
// that difficulty is equal to that one.
|
||||
StoredBlock cursor = storedPrev;
|
||||
while (!cursor.getHeader().equals(getGenesisBlock()) &&
|
||||
cursor.getHeight() % getInterval() != 0 &&
|
||||
cursor.getHeader().getDifficultyTargetAsInteger().equals(getMaxTarget()))
|
||||
cursor = cursor.getPrev(blockStore);
|
||||
BigInteger cursorTarget = cursor.getHeader().getDifficultyTargetAsInteger();
|
||||
BigInteger newTarget = nextBlock.getDifficultyTargetAsInteger();
|
||||
if (!cursorTarget.equals(newTarget))
|
||||
throw new VerificationException("Testnet block transition that is not allowed: " +
|
||||
Long.toHexString(cursor.getHeader().getDifficultyTarget()) + " vs " +
|
||||
Long.toHexString(nextBlock.getDifficultyTarget()));
|
||||
// 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.
|
||||
StoredBlock cursor = storedPrev;
|
||||
while (!cursor.getHeader().equals(getGenesisBlock()) &&
|
||||
cursor.getHeight() % getInterval() != 0 &&
|
||||
cursor.getHeader().getDifficultyTargetAsInteger().equals(getMaxTarget()))
|
||||
cursor = cursor.getPrev(blockStore);
|
||||
BigInteger cursorTarget = cursor.getHeader().getDifficultyTargetAsInteger();
|
||||
BigInteger newTarget = nextBlock.getDifficultyTargetAsInteger();
|
||||
if (!cursorTarget.equals(newTarget))
|
||||
throw new VerificationException("Testnet block transition that is not allowed: " +
|
||||
Long.toHexString(cursor.getHeader().getDifficultyTarget()) + " vs " +
|
||||
Long.toHexString(nextBlock.getDifficultyTarget()));
|
||||
}
|
||||
} else {
|
||||
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.
|
||||
* 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. */
|
||||
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)
|
||||
builder.data(signature);
|
||||
if (multisigProgramBytes!= null)
|
||||
builder.data(multisigProgramBytes);
|
||||
builder.data(multisigProgramBytes);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
@@ -809,7 +809,7 @@ public abstract class BtcFormat extends Format {
|
||||
* locale.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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 "µ฿"}.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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);
|
||||
numberFormat.setDecimalFormatSymbols(anteSigns);
|
||||
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
|
||||
* number of satoshis having the equivalent value. */
|
||||
private static BigInteger inSatoshis(Object qty) {
|
||||
BigInteger satoshis;
|
||||
BigInteger satoshis;
|
||||
// the value might be bitcoins or satoshis
|
||||
if (qty instanceof Long || qty instanceof Integer)
|
||||
satoshis = BigInteger.valueOf(((Number)qty).longValue());
|
||||
else if (qty instanceof BigInteger)
|
||||
satoshis = (BigInteger)qty;
|
||||
else if (qty instanceof BigDecimal)
|
||||
satoshis = ((BigDecimal)qty).movePointRight(Coin.SMALLEST_UNIT_EXPONENT).
|
||||
if (qty instanceof Long || qty instanceof Integer)
|
||||
satoshis = BigInteger.valueOf(((Number)qty).longValue());
|
||||
else if (qty instanceof BigInteger)
|
||||
satoshis = (BigInteger)qty;
|
||||
else if (qty instanceof BigDecimal)
|
||||
satoshis = ((BigDecimal)qty).movePointRight(Coin.SMALLEST_UNIT_EXPONENT).
|
||||
setScale(0,BigDecimal.ROUND_HALF_UP).unscaledValue();
|
||||
else if (qty instanceof Coin)
|
||||
satoshis = BigInteger.valueOf(((Coin)qty).value);
|
||||
else
|
||||
throw new IllegalArgumentException("Cannot format a " + qty.getClass().getSimpleName() +
|
||||
else if (qty instanceof Coin)
|
||||
satoshis = BigInteger.valueOf(((Coin)qty).value);
|
||||
else
|
||||
throw new IllegalArgumentException("Cannot format a " + qty.getClass().getSimpleName() +
|
||||
" as a Bicoin value");
|
||||
return satoshis;
|
||||
}
|
||||
|
Reference in New Issue
Block a user