diff --git a/docs/com/google/bitcoin/core/Block.html b/docs/com/google/bitcoin/core/Block.html
index 80f80b82..e8ed75c1 100644
--- a/docs/com/google/bitcoin/core/Block.html
+++ b/docs/com/google/bitcoin/core/Block.html
@@ -161,14 +161,6 @@ A block is the foundation of the BitCoin system. It records a set of
- void |
-addTransaction(Transaction t)
-
-
- Adds a transaction to this block. |
-
-
-
Block |
cloneAsHeader()
@@ -270,54 +262,6 @@ A block is the foundation of the BitCoin system. It records a set of hashCode()
-
- |
-
-
-
- void |
-setDifficultyTarget(long compactForm)
-
-
- |
-
-
-
- void |
-setMerkleRoot(byte[] value)
-
-
- |
-
-
-
- void |
-setNonce(long nonce)
-
-
- |
-
-
-
- void |
-setPrevBlockHash(byte[] prevBlockHash)
-
-
- |
-
-
-
- void |
-setTime(long time)
-
-
- |
-
-
-
- void |
-setVersion(long version)
-
|
@@ -550,30 +494,6 @@ public byte[] getMerkleRoot()
-
-setMerkleRoot
-
-public void setMerkleRoot(byte[] value)
-
-
-
-
-
-
-
-
-addTransaction
-
-public void addTransaction(Transaction t)
-
-- Adds a transaction to this block.
-
-
-
-
-
-
-
getVersion
@@ -587,17 +507,6 @@ public long getVersion()
-
-setVersion
-
-public void setVersion(long version)
-
-
-
-
-
-
-
getPrevBlockHash
@@ -611,17 +520,6 @@ public byte[] getPrevBlockHash()
-
-setPrevBlockHash
-
-public void setPrevBlockHash(byte[] prevBlockHash)
-
-
-
-
-
-
-
getTime
@@ -635,17 +533,6 @@ public long getTime()
-
-setTime
-
-public void setTime(long time)
-
-
-
-
-
-
-
getDifficultyTarget
@@ -661,17 +548,6 @@ public long getDifficultyTarget()
-
-setDifficultyTarget
-
-public void setDifficultyTarget(long compactForm)
-
-
-
-
-
-
-
getNonce
@@ -684,17 +560,6 @@ public long getNonce()
-
-
-
-setNonce
-
-public void setNonce(long nonce)
-
-
-
-
-
diff --git a/docs/index-all.html b/docs/index-all.html
index f4a5c151..02948f79 100644
--- a/docs/index-all.html
+++ b/docs/index-all.html
@@ -108,10 +108,7 @@ Constructor for exception com.google.bitcoin.core.addressHeader -
Variable in class com.google.bitcoin.core.NetworkParameters
First byte of a base58 encoded address.
-AddressMessage - Class in com.google.bitcoin.core addTransaction(Transaction) -
-Method in class com.google.bitcoin.core.Block
-Adds a transaction to this block.
-
+AddressMessage - Class in com.google.bitcoin.core
B
@@ -639,27 +636,9 @@ Constructor for exception com.google.bitcoin.core.sendCoins(Peer, Address, BigInteger) -
Method in class com.google.bitcoin.core.Wallet
Sends coins to the given address, via the given Peer
.
-setDifficultyTarget(long) -
-Method in class com.google.bitcoin.core.Block
-
-setMerkleRoot(byte[]) -
-Method in class com.google.bitcoin.core.Block
-
-setNonce(long) -
-Method in class com.google.bitcoin.core.Block
-
-setPrevBlockHash(byte[]) -
-Method in class com.google.bitcoin.core.Block
-
-setTime(long) -
-Method in class com.google.bitcoin.core.Block
-
setTracing(boolean) -
Method in class com.google.bitcoin.core.Script
If true, running a program will log its instructions.
-setVersion(long) -
-Method in class com.google.bitcoin.core.Block
-
sha256hash160(byte[]) -
Static method in class com.google.bitcoin.core.Utils
Calculates RIPEMD160(SHA256(input)).
diff --git a/docs/serialized-form.html b/docs/serialized-form.html
index b7687485..e67f0141 100644
--- a/docs/serialized-form.html
+++ b/docs/serialized-form.html
@@ -214,26 +214,6 @@ java.util.List<E> transactions
-
-
-hash
-
-byte[] hash
-
-- Stores the hash of the block. If null, getHash() will recalculate it.
-
-
-
-
-
-
-prevBlock
-
-Block prevBlock
-
-
-
-
diff --git a/src/com/google/bitcoin/core/Block.java b/src/com/google/bitcoin/core/Block.java
index 963ea37d..ba864b17 100644
--- a/src/com/google/bitcoin/core/Block.java
+++ b/src/com/google/bitcoin/core/Block.java
@@ -51,15 +51,10 @@ public class Block extends Message {
/** If null, it means this object holds only the headers. */
List transactions;
+
/** Stores the hash of the block. If null, getHash() will recalculate it. */
transient private byte[] hash;
- // If set, points towards the previous block in the chain. Note that a block may have multiple other blocks
- // pointing back to it because despite being called a "chain", the block chain is in fact a tree. There can be
- // splits which are resolved by selecting the head that has the largest total cumulative work when measured down
- // to the genesis block.
- Block prevBlock;
-
/** Special case constructor, used for the genesis node and unit tests. */
Block(NetworkParameters params) {
super(params);
@@ -328,19 +323,17 @@ public class Block extends Message {
* @throws VerificationException
*/
public void verify() throws VerificationException {
- // Now we need to prove that this block is OK. It might seem that we can just ignore
- // most of these checks, given that the network is also verifying the blocks, but we
- // cannot as it'd open us to a variety of obscure attacks.
+ // Prove that this block is OK. It might seem that we can just ignore most of these checks given that the
+ // network is also verifying the blocks, but we cannot as it'd open us to a variety of obscure attacks.
//
- // Firstly we need to ensure this block does in fact represent real work done. If the
- // difficulty is high enough, it's probably been done by the network.
+ // Firstly we need to ensure this block does in fact represent real work done. If the difficulty is high
+ // enough, it's probably been done by the network.
checkProofOfWork(true);
checkTimestamp();
- // Now we need to check that the body of the block actually matches the headers. The
- // network won't generate an invalid block, but if we didn't validate this then an
- // untrusted man-in-the-middle could obtain the next valid block from the network and
- // simply replace the transactions in it with their own fictional transactions that
- // reference spent or non-existant inputs.
+ // Now we need to check that the body of the block actually matches the headers. The network won't generate
+ // an invalid block, but if we didn't validate this then an untrusted man-in-the-middle could obtain the next
+ // valid block from the network and simply replace the transactions in it with their own fictional
+ // transactions that reference spent or non-existant inputs.
if (transactions != null) {
assert transactions.size() > 0;
checkTransactions();
@@ -367,15 +360,14 @@ public class Block extends Message {
return merkleRoot;
}
- public void setMerkleRoot(byte[] value) {
+ /** Exists only for unit testing. */
+ void setMerkleRoot(byte[] value) {
merkleRoot = value;
hash = null;
}
- /**
- * Adds a transaction to this block.
- */
- public void addTransaction(Transaction t) {
+ /** Adds a transaction to this block. */
+ void addTransaction(Transaction t) {
if (transactions == null) {
transactions = new ArrayList();
}
@@ -385,38 +377,27 @@ public class Block extends Message {
hash = null;
}
- /**
- * Returns the version of the block data structure as defined by the BitCoin protocol.
- */
+ /** Returns the version of the block data structure as defined by the BitCoin protocol. */
public long getVersion() {
return version;
}
- public void setVersion(long version) {
- this.version = version;
- this.hash = null;
- }
-
- /**
- * Returns the hash of the previous block in the chain, as defined by the block header.
- */
+ /** Returns the hash of the previous block in the chain, as defined by the block header. */
public byte[] getPrevBlockHash() {
return prevBlockHash;
}
- public void setPrevBlockHash(byte[] prevBlockHash) {
+ void setPrevBlockHash(byte[] prevBlockHash) {
this.prevBlockHash = prevBlockHash;
this.hash = null;
}
- /**
- * Returns the time at which the block was solved and broadcast, according to the clock of the solving node.
- */
+ /** Returns the time at which the block was solved and broadcast, according to the clock of the solving node. */
public long getTime() {
return time;
}
- public void setTime(long time) {
+ void setTime(long time) {
this.time = time;
this.hash = null;
}
@@ -430,7 +411,7 @@ public class Block extends Message {
return difficultyTarget;
}
- public void setDifficultyTarget(long compactForm) {
+ void setDifficultyTarget(long compactForm) {
this.difficultyTarget = compactForm;
this.hash = null;
}
@@ -443,7 +424,7 @@ public class Block extends Message {
return nonce;
}
- public void setNonce(long nonce) {
+ void setNonce(long nonce) {
this.nonce = nonce;
this.hash = null;
}