mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-16 04:05:50 +00:00
In comments and one log output, use wording "best chain" instead of "main chain".
This commit is contained in:
parent
0833fe1cea
commit
5d9f25b03a
@ -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
|
// 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.
|
// 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.
|
// 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());
|
newBlock.getHeight(), newBlock.getHeader().getHash());
|
||||||
return;
|
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.
|
// Then build a list of all blocks in the old part of the chain and the new part.
|
||||||
final LinkedList<StoredBlock> oldBlocks = getPartialChain(head, splitPoint, blockStore);
|
final LinkedList<StoredBlock> oldBlocks = getPartialChain(head, splitPoint, blockStore);
|
||||||
final LinkedList<StoredBlock> newBlocks = getPartialChain(newChainHead, splitPoint, blockStore);
|
final LinkedList<StoredBlock> 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;
|
StoredBlock storedNewHead = splitPoint;
|
||||||
if (shouldVerifyTransactions()) {
|
if (shouldVerifyTransactions()) {
|
||||||
for (StoredBlock oldBlock : oldBlocks) {
|
for (StoredBlock oldBlock : oldBlocks) {
|
||||||
|
@ -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
|
// 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
|
// 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
|
// 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);
|
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
|
// Set the input to the script of its output. Bitcoin Core does this but the step has no obvious purpose as
|
||||||
|
@ -49,7 +49,7 @@ import static com.google.common.base.Preconditions.*;
|
|||||||
* <li>Receiving it from multiple peers on the network. If your network connection is not being intercepted,
|
* <li>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
|
* 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).</li>
|
* thus miners likely have too (miners have the final say in whether a transaction becomes valid or not).</li>
|
||||||
* <li>Seeing the transaction appear appear in a block on the main chain. Your confidence increases as the transaction
|
* <li>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
|
* becomes further buried under work. Work can be measured either in blocks (roughly, units of time), or
|
||||||
* amount of work done.</li>
|
* amount of work done.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
|
@ -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
|
// 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,
|
// 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());
|
boolean isDeadCoinbase = tx.isCoinBase() && dead.containsKey(tx.getHash());
|
||||||
if (isDeadCoinbase) {
|
if (isDeadCoinbase) {
|
||||||
// There is a dead coinbase tx being received on the best chain. A coinbase tx is made dead when it moves
|
// There is a dead coinbase tx being received on the best chain. A coinbase tx is made dead when it moves
|
||||||
|
@ -276,7 +276,7 @@ public class ChainSplitTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testForking6() throws Exception {
|
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);
|
Block b1 = UNITTEST.getGenesisBlock().createNextBlock(someOtherGuy);
|
||||||
chain.add(b1);
|
chain.add(b1);
|
||||||
// genesis -> b1
|
// genesis -> b1
|
||||||
|
@ -509,7 +509,7 @@ public class WalletTest extends TestWithWallet {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sideChain() throws Exception {
|
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.
|
// as we assume the side chain tx is pending and will be included shortly.
|
||||||
Coin v1 = COIN;
|
Coin v1 = COIN;
|
||||||
sendMoneyToWallet(AbstractBlockChain.NewBlockType.BEST_CHAIN, v1);
|
sendMoneyToWallet(AbstractBlockChain.NewBlockType.BEST_CHAIN, v1);
|
||||||
@ -1413,7 +1413,7 @@ public class WalletTest extends TestWithWallet {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void pending3() throws Exception {
|
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
|
// 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.
|
// connect to anything.
|
||||||
Coin nanos = COIN;
|
Coin nanos = COIN;
|
||||||
@ -1457,7 +1457,7 @@ public class WalletTest extends TestWithWallet {
|
|||||||
Threading.waitForUserCode();
|
Threading.waitForUserCode();
|
||||||
assertEquals(t1, called[0]);
|
assertEquals(t1, called[0]);
|
||||||
assertEquals(nanos, wallet.getBalance(Wallet.BalanceType.ESTIMATED));
|
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;
|
called[0] = called[1] = null;
|
||||||
sendMoneyToWallet(AbstractBlockChain.NewBlockType.BEST_CHAIN, t2);
|
sendMoneyToWallet(AbstractBlockChain.NewBlockType.BEST_CHAIN, t2);
|
||||||
Threading.waitForUserCode();
|
Threading.waitForUserCode();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user