mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-07-31 12:01:24 +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
|
// 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.
|
// to become the new best chain head. This simplifies handling of the re-org in the Wallet class.
|
||||||
boolean causedSplit = newStoredBlock.moreWorkThan(chainHead);
|
boolean haveNewBestChain = newStoredBlock.moreWorkThan(chainHead);
|
||||||
if (causedSplit) {
|
if (haveNewBestChain) {
|
||||||
log.info("Block is causing a re-organize");
|
log.info("Block is causing a re-organize");
|
||||||
} else {
|
} else {
|
||||||
log.info("Block forks the chain, but it did not cause a reorganize.");
|
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);
|
sendTransactionsToWallet(newStoredBlock, NewBlockType.SIDE_CHAIN, newTransactions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (causedSplit)
|
if (haveNewBestChain)
|
||||||
handleChainSplit(newStoredBlock);
|
handleNewBestChain(newStoredBlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called as part of connecting a block when the new block results in a different chain having higher total work.
|
* 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.
|
// 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
|
// Firstly, calculate the block at which the chain diverged. We only need to examine the
|
||||||
|
@@ -16,6 +16,9 @@
|
|||||||
|
|
||||||
package com.google.bitcoin.core;
|
package com.google.bitcoin.core;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -26,6 +29,7 @@ import java.math.BigInteger;
|
|||||||
* of the Transaction message.
|
* of the Transaction message.
|
||||||
*/
|
*/
|
||||||
public class TransactionOutput extends Message implements Serializable {
|
public class TransactionOutput extends Message implements Serializable {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(TransactionOutput.class);
|
||||||
private static final long serialVersionUID = -590332479859256824L;
|
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
|
// 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();
|
byte[] pubkeyHash = getScriptPubKey().getPubKeyHash();
|
||||||
return wallet.isPubKeyHashMine(pubkeyHash);
|
return wallet.isPubKeyHashMine(pubkeyHash);
|
||||||
} catch (ScriptException e) {
|
} 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