From 5d9f25b03a98f6e146ceef1e9949c6e8ff305a2e Mon Sep 17 00:00:00 2001 From: Oscar Guindzberg Date: Thu, 24 Jan 2019 11:47:36 -0300 Subject: [PATCH] In comments and one log output, use wording "best chain" instead of "main chain". --- .../src/main/java/org/bitcoinj/core/AbstractBlockChain.java | 4 ++-- core/src/main/java/org/bitcoinj/core/Transaction.java | 2 +- .../main/java/org/bitcoinj/core/TransactionConfidence.java | 2 +- core/src/main/java/org/bitcoinj/wallet/Wallet.java | 2 +- core/src/test/java/org/bitcoinj/core/ChainSplitTest.java | 2 +- core/src/test/java/org/bitcoinj/wallet/WalletTest.java | 6 +++--- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/org/bitcoinj/core/AbstractBlockChain.java b/core/src/main/java/org/bitcoinj/core/AbstractBlockChain.java index 4fd4a0fd..21271dc7 100644 --- a/core/src/main/java/org/bitcoinj/core/AbstractBlockChain.java +++ b/core/src/main/java/org/bitcoinj/core/AbstractBlockChain.java @@ -581,7 +581,7 @@ public abstract class AbstractBlockChain { // newStoredBlock is a part of the same chain, there's no fork. This happens when we receive a block // that we already saw and linked into the chain previously, which isn't the chain head. // Re-processing it is confusing for the wallet so just skip. - log.warn("Saw duplicated block in main chain at height {}: {}", + log.warn("Saw duplicated block in best chain at height {}: {}", newBlock.getHeight(), newBlock.getHeader().getHash()); return; } @@ -757,7 +757,7 @@ public abstract class AbstractBlockChain { // Then build a list of all blocks in the old part of the chain and the new part. final LinkedList oldBlocks = getPartialChain(head, splitPoint, blockStore); final LinkedList newBlocks = getPartialChain(newChainHead, splitPoint, blockStore); - // Disconnect each transaction in the previous main chain that is no longer in the new main chain + // Disconnect each transaction in the previous best chain that is no longer in the new best chain StoredBlock storedNewHead = splitPoint; if (shouldVerifyTransactions()) { for (StoredBlock oldBlock : oldBlocks) { diff --git a/core/src/main/java/org/bitcoinj/core/Transaction.java b/core/src/main/java/org/bitcoinj/core/Transaction.java index 653fbb5c..b9e44f17 100644 --- a/core/src/main/java/org/bitcoinj/core/Transaction.java +++ b/core/src/main/java/org/bitcoinj/core/Transaction.java @@ -1123,7 +1123,7 @@ public class Transaction extends ChildMessage { // the design we use today where scripts are executed independently but share a stack. This left the // OP_CODESEPARATOR instruction having no purpose as it was only meant to be used internally, not actually // ever put into scripts. Deleting OP_CODESEPARATOR is a step that should never be required but if we don't - // do it, we could split off the main chain. + // do it, we could split off the best chain. connectedScript = Script.removeAllInstancesOfOp(connectedScript, ScriptOpCodes.OP_CODESEPARATOR); // Set the input to the script of its output. Bitcoin Core does this but the step has no obvious purpose as diff --git a/core/src/main/java/org/bitcoinj/core/TransactionConfidence.java b/core/src/main/java/org/bitcoinj/core/TransactionConfidence.java index f92bf982..15be737d 100644 --- a/core/src/main/java/org/bitcoinj/core/TransactionConfidence.java +++ b/core/src/main/java/org/bitcoinj/core/TransactionConfidence.java @@ -49,7 +49,7 @@ import static com.google.common.base.Preconditions.*; *
  • Receiving it from multiple peers on the network. If your network connection is not being intercepted, * hearing about a transaction from multiple peers indicates the network has accepted the transaction and * thus miners likely have too (miners have the final say in whether a transaction becomes valid or not).
  • - *
  • Seeing the transaction appear appear in a block on the main chain. Your confidence increases as the transaction + *
  • Seeing the transaction appear appear in a block on the best chain. Your confidence increases as the transaction * becomes further buried under work. Work can be measured either in blocks (roughly, units of time), or * amount of work done.
  • * diff --git a/core/src/main/java/org/bitcoinj/wallet/Wallet.java b/core/src/main/java/org/bitcoinj/wallet/Wallet.java index e69d3e9a..23d70f4c 100644 --- a/core/src/main/java/org/bitcoinj/wallet/Wallet.java +++ b/core/src/main/java/org/bitcoinj/wallet/Wallet.java @@ -2178,7 +2178,7 @@ public class Wallet extends BaseTaggableObject // This TX may spend our existing outputs even though it was not pending. This can happen in unit // tests, if keys are moved between wallets, if we're catching up to the chain given only a set of keys, - // or if a dead coinbase transaction has moved back onto the main chain. + // or if a dead coinbase transaction has moved back onto the best chain. boolean isDeadCoinbase = tx.isCoinBase() && dead.containsKey(tx.getHash()); if (isDeadCoinbase) { // There is a dead coinbase tx being received on the best chain. A coinbase tx is made dead when it moves diff --git a/core/src/test/java/org/bitcoinj/core/ChainSplitTest.java b/core/src/test/java/org/bitcoinj/core/ChainSplitTest.java index 860b7d66..f785d268 100644 --- a/core/src/test/java/org/bitcoinj/core/ChainSplitTest.java +++ b/core/src/test/java/org/bitcoinj/core/ChainSplitTest.java @@ -276,7 +276,7 @@ public class ChainSplitTest { @Test public void testForking6() throws Exception { - // Test the case in which a side chain block contains a tx, and then it appears in the main chain too. + // Test the case in which a side chain block contains a tx, and then it appears in the best chain too. Block b1 = UNITTEST.getGenesisBlock().createNextBlock(someOtherGuy); chain.add(b1); // genesis -> b1 diff --git a/core/src/test/java/org/bitcoinj/wallet/WalletTest.java b/core/src/test/java/org/bitcoinj/wallet/WalletTest.java index 1ebd9f5b..c0b3d251 100644 --- a/core/src/test/java/org/bitcoinj/wallet/WalletTest.java +++ b/core/src/test/java/org/bitcoinj/wallet/WalletTest.java @@ -509,7 +509,7 @@ public class WalletTest extends TestWithWallet { @Test public void sideChain() throws Exception { - // The wallet receives a coin on the main chain, then on a side chain. Balance is equal to both added together + // The wallet receives a coin on the best chain, then on a side chain. Balance is equal to both added together // as we assume the side chain tx is pending and will be included shortly. Coin v1 = COIN; sendMoneyToWallet(AbstractBlockChain.NewBlockType.BEST_CHAIN, v1); @@ -1413,7 +1413,7 @@ public class WalletTest extends TestWithWallet { @Test public void pending3() throws Exception { - // Check that if we receive a pending tx, and it's overridden by a double spend from the main chain, we + // Check that if we receive a pending tx, and it's overridden by a double spend from the best chain, we // are notified that it's dead. This should work even if the pending tx inputs are NOT ours, ie, they don't // connect to anything. Coin nanos = COIN; @@ -1457,7 +1457,7 @@ public class WalletTest extends TestWithWallet { Threading.waitForUserCode(); assertEquals(t1, called[0]); assertEquals(nanos, wallet.getBalance(Wallet.BalanceType.ESTIMATED)); - // Now receive a double spend on the main chain. + // Now receive a double spend on the best chain. called[0] = called[1] = null; sendMoneyToWallet(AbstractBlockChain.NewBlockType.BEST_CHAIN, t2); Threading.waitForUserCode();