You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The method toString is called by the debugger many times during a debug session, even if the debug window is not open.
The BtcBlock.java class implements the following code:
public String toString() {
StringBuilder s = new StringBuilder();
s.append(" block: \n");
s.append(" hash: ").append(getHashAsString()).append('\n');
But the method getHashAsString modifies the internal state:
public String getHashAsString() {
return getHash().toString();
}
@Override
public Sha256Hash getHash() {
if (hash == null)
hash = calculateHash();
return hash;
}
Therefore the method getHashAsString / getHash methods should be replaced by:
public String toString() {
StringBuilder s = new StringBuilder();
s.append(" block: \n");
s.append(" hash: ").append(getHashAsStringDebug()).append('\n');
.....
public String getHashAsStringDebug() {
return getHash().toString();
}
....
public Sha256Hash getHashDebug() {
Sha256Hash localHash = calculateHash();
return localHash;
}
The text was updated successfully, but these errors were encountered:
The method toString is called by the debugger many times during a debug session, even if the debug window is not open.
The BtcBlock.java class implements the following code:
But the method getHashAsString modifies the internal state:
Therefore the method getHashAsString / getHash methods should be replaced by:
The text was updated successfully, but these errors were encountered: