From 0f216d328f67d91d090bcd6d42a5f6510f91cc2d Mon Sep 17 00:00:00 2001 From: Sean Gilligan Date: Sat, 18 Mar 2023 12:08:49 -0700 Subject: [PATCH] Block, BitcoinNetwork, BitcoinNetworkParams, KeyChainGroupTest: use `_000` in constants to improve readability --- core/src/main/java/org/bitcoinj/base/BitcoinNetwork.java | 2 +- core/src/main/java/org/bitcoinj/core/Block.java | 2 +- .../main/java/org/bitcoinj/params/BitcoinNetworkParams.java | 2 +- core/src/test/java/org/bitcoinj/wallet/KeyChainGroupTest.java | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/bitcoinj/base/BitcoinNetwork.java b/core/src/main/java/org/bitcoinj/base/BitcoinNetwork.java index 27285cbd5..c4c752076 100644 --- a/core/src/main/java/org/bitcoinj/base/BitcoinNetwork.java +++ b/core/src/main/java/org/bitcoinj/base/BitcoinNetwork.java @@ -51,7 +51,7 @@ public enum BitcoinNetwork implements Network { /** * The maximum number of coins to be generated */ - private static final long MAX_COINS = 21000000; + private static final long MAX_COINS = 21_000_000; /** * The maximum money to be generated diff --git a/core/src/main/java/org/bitcoinj/core/Block.java b/core/src/main/java/org/bitcoinj/core/Block.java index ccd8566eb..363938456 100644 --- a/core/src/main/java/org/bitcoinj/core/Block.java +++ b/core/src/main/java/org/bitcoinj/core/Block.java @@ -88,7 +88,7 @@ public class Block extends Message { * upgrade everyone to change this, so Bitcoin can continue to grow. For now it exists as an anti-DoS measure to * avoid somebody creating a titanically huge but valid block and forcing everyone to download/store it forever. */ - public static final int MAX_BLOCK_SIZE = 1 * 1000 * 1000; + public static final int MAX_BLOCK_SIZE = 1_000_000; /** * A "sigop" is a signature verification operation. Because they're expensive we also impose a separate limit on * the number in a block to prevent somebody mining a huge block that has way more sigops than normal, so is very diff --git a/core/src/main/java/org/bitcoinj/params/BitcoinNetworkParams.java b/core/src/main/java/org/bitcoinj/params/BitcoinNetworkParams.java index ef6a1e33a..2c4df323b 100644 --- a/core/src/main/java/org/bitcoinj/params/BitcoinNetworkParams.java +++ b/core/src/main/java/org/bitcoinj/params/BitcoinNetworkParams.java @@ -59,7 +59,7 @@ public abstract class BitcoinNetworkParams extends NetworkParameters { /** * Block reward halving interval (number of blocks) */ - public static final int REWARD_HALVING_INTERVAL = 210000; + public static final int REWARD_HALVING_INTERVAL = 210_000; private static final Logger log = LoggerFactory.getLogger(BitcoinNetworkParams.class); diff --git a/core/src/test/java/org/bitcoinj/wallet/KeyChainGroupTest.java b/core/src/test/java/org/bitcoinj/wallet/KeyChainGroupTest.java index d1c041109..f7079effc 100644 --- a/core/src/test/java/org/bitcoinj/wallet/KeyChainGroupTest.java +++ b/core/src/test/java/org/bitcoinj/wallet/KeyChainGroupTest.java @@ -409,9 +409,9 @@ public class KeyChainGroupTest { Instant now = TimeUtils.currentTime().truncatedTo(ChronoUnit.SECONDS); TimeUtils.setMockClock(now); assertEquals(now, group.earliestKeyCreationTime()); - TimeUtils.rollMockClock(Duration.ofSeconds(10000)); + TimeUtils.rollMockClock(Duration.ofSeconds(10_000)); group.freshKey(KeyChain.KeyPurpose.RECEIVE_FUNDS); - TimeUtils.rollMockClock(Duration.ofSeconds(10000)); + TimeUtils.rollMockClock(Duration.ofSeconds(10_000)); group.freshKey(KeyChain.KeyPurpose.RECEIVE_FUNDS); // Check that all keys are assumed to be created at the same instant the seed is. assertEquals(now, group.earliestKeyCreationTime());