Block: Add to some mutating methods
These methods should only be used for testing and will hopefully be
deprecated and/or refactored to another class in the future.
@@ -498,6 +498,7 @@ public class Block extends Message {
* <p>This can loop forever if a solution cannot be found solely by incrementing nonce. It doesn't change
* extraNonce.</p>
*/
+ @VisibleForTesting
public void solve() {
while (true) {
try {
@@ -773,6 +774,7 @@ public class Block extends Message {
}
/** Exists only for unit testing. */
+ @VisibleForTesting
void setMerkleRoot(Sha256Hash value) {
unCacheHeader();
merkleRoot = value;
@@ -823,6 +825,7 @@ public class Block extends Message {
return prevBlockHash;
}
+ @VisibleForTesting
void setPrevBlockHash(Sha256Hash prevBlockHash) {
unCacheHeader();
this.prevBlockHash = prevBlockHash;
@@ -844,6 +847,7 @@ public class Block extends Message {
return new Date(getTimeSeconds()*1000);
}
+ @VisibleForTesting
public void setTime(long time) {
unCacheHeader();
this.time = time;
@@ -864,6 +868,7 @@ public class Block extends Message {
}
/** Sets the difficulty target in compact form. */
+ @VisibleForTesting
public void setDifficultyTarget(long compactForm) {
unCacheHeader();
this.difficultyTarget = compactForm;
@@ -879,6 +884,7 @@ public class Block extends Message {
}
/** Sets the nonce and clears any cached data. */
+ @VisibleForTesting
public void setNonce(long nonce) {
unCacheHeader();
this.nonce = nonce;
@@ -947,6 +953,7 @@ public class Block extends Message {
*
* @param height block height, if known, or -1 otherwise.
*/
+ @VisibleForTesting
Block createNextBlock(@Nullable final Address to, final long version,
@Nullable TransactionOutPoint prevOut, final long time,
final byte[] pubKey, final Coin coinbaseValue,
