From 36c6c6e3af22927231a2c81cea510a3e2c9e5711 Mon Sep 17 00:00:00 2001 From: Oscar Guindzberg Date: Wed, 13 Mar 2019 14:52:01 -0300 Subject: [PATCH] Replace tabs with spaces. --- .../params/AbstractBitcoinNetParams.java | 2 +- .../org/bitcoinj/params/TestNet3Params.java | 26 ++++++------ .../channels/PaymentChannelServerState.java | 2 +- .../org/bitcoinj/script/ScriptBuilder.java | 4 +- .../java/org/bitcoinj/utils/BtcFormat.java | 40 +++++++++---------- 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/core/src/main/java/org/bitcoinj/params/AbstractBitcoinNetParams.java b/core/src/main/java/org/bitcoinj/params/AbstractBitcoinNetParams.java index 35ab5baa..73339b94 100644 --- a/core/src/main/java/org/bitcoinj/params/AbstractBitcoinNetParams.java +++ b/core/src/main/java/org/bitcoinj/params/AbstractBitcoinNetParams.java @@ -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? diff --git a/core/src/main/java/org/bitcoinj/params/TestNet3Params.java b/core/src/main/java/org/bitcoinj/params/TestNet3Params.java index ee856e66..323d4055 100644 --- a/core/src/main/java/org/bitcoinj/params/TestNet3Params.java +++ b/core/src/main/java/org/bitcoinj/params/TestNet3Params.java @@ -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); diff --git a/core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelServerState.java b/core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelServerState.java index cb685e41..ef091847 100644 --- a/core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelServerState.java +++ b/core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelServerState.java @@ -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. * diff --git a/core/src/main/java/org/bitcoinj/script/ScriptBuilder.java b/core/src/main/java/org/bitcoinj/script/ScriptBuilder.java index 78e8ea13..e2a283da 100644 --- a/core/src/main/java/org/bitcoinj/script/ScriptBuilder.java +++ b/core/src/main/java/org/bitcoinj/script/ScriptBuilder.java @@ -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 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(); } diff --git a/core/src/main/java/org/bitcoinj/utils/BtcFormat.java b/core/src/main/java/org/bitcoinj/utils/BtcFormat.java index 5e5561a7..5a1d560b 100644 --- a/core/src/main/java/org/bitcoinj/utils/BtcFormat.java +++ b/core/src/main/java/org/bitcoinj/utils/BtcFormat.java @@ -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; }