mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-07-30 03:21:23 +00:00
Some small renamings in BlockChain. Log but don't throw in TransactionOutput.isMine() if the script is unparseable. Suggestions from Miron.
This commit is contained in:
@@ -163,8 +163,8 @@ public class BlockChain {
|
||||
//
|
||||
// Note that we send the transactions to the wallet FIRST, even if we're about to re-organize this block
|
||||
// to become the new best chain head. This simplifies handling of the re-org in the Wallet class.
|
||||
boolean causedSplit = newStoredBlock.moreWorkThan(chainHead);
|
||||
if (causedSplit) {
|
||||
boolean haveNewBestChain = newStoredBlock.moreWorkThan(chainHead);
|
||||
if (haveNewBestChain) {
|
||||
log.info("Block is causing a re-organize");
|
||||
} else {
|
||||
log.info("Block forks the chain, but it did not cause a reorganize.");
|
||||
@@ -176,15 +176,15 @@ public class BlockChain {
|
||||
sendTransactionsToWallet(newStoredBlock, NewBlockType.SIDE_CHAIN, newTransactions);
|
||||
}
|
||||
|
||||
if (causedSplit)
|
||||
handleChainSplit(newStoredBlock);
|
||||
if (haveNewBestChain)
|
||||
handleNewBestChain(newStoredBlock);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called as part of connecting a block when the new block results in a different chain having higher total work.
|
||||
*/
|
||||
private void handleChainSplit(StoredBlock newChainHead) throws BlockStoreException, VerificationException {
|
||||
private void handleNewBestChain(StoredBlock newChainHead) throws BlockStoreException, VerificationException {
|
||||
// This chain has overtaken the one we currently believe is best. Reorganize is required.
|
||||
//
|
||||
// Firstly, calculate the block at which the chain diverged. We only need to examine the
|
||||
|
@@ -16,6 +16,9 @@
|
||||
|
||||
package com.google.bitcoin.core;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Serializable;
|
||||
@@ -26,6 +29,7 @@ import java.math.BigInteger;
|
||||
* of the Transaction message.
|
||||
*/
|
||||
public class TransactionOutput extends Message implements Serializable {
|
||||
private static final Logger log = LoggerFactory.getLogger(TransactionOutput.class);
|
||||
private static final long serialVersionUID = -590332479859256824L;
|
||||
|
||||
// A transaction output has some value and a script used for authenticating that the redeemer is allowed to spend
|
||||
@@ -114,7 +118,8 @@ public class TransactionOutput extends Message implements Serializable {
|
||||
byte[] pubkeyHash = getScriptPubKey().getPubKeyHash();
|
||||
return wallet.isPubKeyHashMine(pubkeyHash);
|
||||
} catch (ScriptException e) {
|
||||
throw new RuntimeException(e);
|
||||
log.error("Could not parse tx output script: {}", e.toString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user