mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-15 11:45:51 +00:00
Always use US locale when formatting debug strings.
This commit is contained in:
parent
0de458db45
commit
feca024107
@ -560,7 +560,7 @@ public class Block extends Message {
|
||||
// Allow injection of a fake clock to allow unit testing.
|
||||
long currentTime = Utils.currentTimeSeconds();
|
||||
if (time > currentTime + ALLOWED_TIME_DRIFT)
|
||||
throw new VerificationException(String.format("Block too far in future: %d vs %d", time, currentTime + ALLOWED_TIME_DRIFT));
|
||||
throw new VerificationException(String.format(Locale.US, "Block too far in future: %d vs %d", time, currentTime + ALLOWED_TIME_DRIFT));
|
||||
}
|
||||
|
||||
private void checkSigOps() throws VerificationException {
|
||||
|
@ -489,7 +489,7 @@ public class Peer extends PeerSocketHandler {
|
||||
peerVersion,
|
||||
vPeerVersionMessage.subVer,
|
||||
vPeerVersionMessage.localServices,
|
||||
String.format("%tF %tT", peerTime, peerTime),
|
||||
String.format(Locale.US, "%tF %tT", peerTime, peerTime),
|
||||
vPeerVersionMessage.bestHeight);
|
||||
// Now it's our turn ...
|
||||
// Send an ACK message stating we accept the peers protocol version.
|
||||
|
@ -1719,7 +1719,7 @@ public class PeerGroup implements TransactionBroadcaster {
|
||||
for (long sample : samples) average += sample;
|
||||
average /= samples.length;
|
||||
|
||||
log.info(String.format("%d blocks/sec, %d tx/sec, %d pre-filtered tx/sec, avg/last %.2f/%.2f kilobytes per sec (stall threshold <%.2f KB/sec for %d seconds)",
|
||||
log.info(String.format(Locale.US, "%d blocks/sec, %d tx/sec, %d pre-filtered tx/sec, avg/last %.2f/%.2f kilobytes per sec (stall threshold <%.2f KB/sec for %d seconds)",
|
||||
blocksInLastSecond, txnsInLastSecond, origTxnsInLastSecond, average / 1024.0, bytesInLastSecond / 1024.0,
|
||||
minSpeedBytesPerSec / 1024.0, samples.length));
|
||||
|
||||
@ -1736,7 +1736,7 @@ public class PeerGroup implements TransactionBroadcaster {
|
||||
log.warn("This network seems to be slower than the requested stall threshold - won't do stall disconnects any more.");
|
||||
} else {
|
||||
Peer peer = getDownloadPeer();
|
||||
log.warn(String.format("Chain download stalled: received %.2f KB/sec for %d seconds, require average of %.2f KB/sec, disconnecting %s", average / 1024.0, samples.length, minSpeedBytesPerSec / 1024.0, peer));
|
||||
log.warn(String.format(Locale.US, "Chain download stalled: received %.2f KB/sec for %d seconds, require average of %.2f KB/sec, disconnecting %s", average / 1024.0, samples.length, minSpeedBytesPerSec / 1024.0, peer));
|
||||
peer.close();
|
||||
// Reset the sample buffer and give the next peer time to get going.
|
||||
samples = null;
|
||||
@ -1746,7 +1746,7 @@ public class PeerGroup implements TransactionBroadcaster {
|
||||
} else {
|
||||
warmupSeconds--;
|
||||
if (bytesInLastSecond > 0)
|
||||
log.info(String.format("%d blocks/sec, %d tx/sec, %d pre-filtered tx/sec, last %.2f kilobytes per sec",
|
||||
log.info(String.format(Locale.US, "%d blocks/sec, %d tx/sec, %d pre-filtered tx/sec, last %.2f kilobytes per sec",
|
||||
blocksInLastSecond, txnsInLastSecond, origTxnsInLastSecond, bytesInLastSecond / 1024.0));
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ package org.bitcoinj.core;
|
||||
import com.google.common.base.Objects;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* A message sent by nodes when a message we sent was rejected (ie a transaction had too little fee/was invalid/etc)
|
||||
@ -145,7 +146,7 @@ public class RejectMessage extends Message {
|
||||
@Override
|
||||
public String toString() {
|
||||
Sha256Hash hash = getRejectedObjectHash();
|
||||
return String.format("Reject: %s %s for reason '%s' (%d)", getRejectedMessage(),
|
||||
return String.format(Locale.US, "Reject: %s %s for reason '%s' (%d)", getRejectedMessage(),
|
||||
hash != null ? hash : "", getReasonString(), getReasonCode().code);
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ import com.google.common.base.Objects;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Locale;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
|
||||
@ -143,7 +144,7 @@ public class StoredBlock {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("Block %s at height %d: %s",
|
||||
return String.format(Locale.US, "Block %s at height %d: %s",
|
||||
getHeader().getHashAsString(), getHeight(), getHeader().toString());
|
||||
}
|
||||
}
|
||||
|
@ -636,7 +636,7 @@ public class Transaction extends ChildMessage {
|
||||
public String toString(@Nullable AbstractBlockChain chain) {
|
||||
// Basic info about the tx.
|
||||
StringBuilder s = new StringBuilder();
|
||||
s.append(String.format(" %s: %s%n", getHashAsString(), getConfidence()));
|
||||
s.append(String.format(Locale.US, " %s: %s%n", getHashAsString(), getConfidence()));
|
||||
if (isTimeLocked()) {
|
||||
String time;
|
||||
if (lockTime < LOCKTIME_THRESHOLD) {
|
||||
@ -648,10 +648,10 @@ public class Transaction extends ChildMessage {
|
||||
} else {
|
||||
time = new Date(lockTime*1000).toString();
|
||||
}
|
||||
s.append(String.format(" time locked until %s%n", time));
|
||||
s.append(String.format(Locale.US, " time locked until %s%n", time));
|
||||
}
|
||||
if (inputs.size() == 0) {
|
||||
s.append(String.format(" INCOMPLETE: No inputs!%n"));
|
||||
s.append(String.format(Locale.US, " INCOMPLETE: No inputs!%n"));
|
||||
return s.toString();
|
||||
}
|
||||
if (isCoinBase()) {
|
||||
@ -692,7 +692,7 @@ public class Transaction extends ChildMessage {
|
||||
} catch (Exception e) {
|
||||
s.append("[exception: ").append(e.getMessage()).append("]");
|
||||
}
|
||||
s.append(String.format("%n"));
|
||||
s.append(String.format(Locale.US, "%n"));
|
||||
}
|
||||
for (TransactionOutput out : outputs) {
|
||||
s.append(" ");
|
||||
@ -712,13 +712,13 @@ public class Transaction extends ChildMessage {
|
||||
} catch (Exception e) {
|
||||
s.append("[exception: ").append(e.getMessage()).append("]");
|
||||
}
|
||||
s.append(String.format("%n"));
|
||||
s.append(String.format(Locale.US, "%n"));
|
||||
}
|
||||
Coin fee = getFee();
|
||||
if (fee != null)
|
||||
s.append(" fee ").append(fee.toFriendlyString()).append(String.format("%n"));
|
||||
s.append(" fee ").append(fee.toFriendlyString()).append(String.format(Locale.US, "%n"));
|
||||
if (purpose != null)
|
||||
s.append(" prps ").append(purpose).append(String.format("%n"));
|
||||
s.append(" prps ").append(purpose).append(String.format(Locale.US, "%n"));
|
||||
return s.toString();
|
||||
}
|
||||
|
||||
|
@ -336,7 +336,7 @@ public class TransactionConfidence {
|
||||
builder.append("In conflict.");
|
||||
break;
|
||||
case BUILDING:
|
||||
builder.append(String.format("Appeared in best chain at height %d, depth %d.",
|
||||
builder.append(String.format(Locale.US, "Appeared in best chain at height %d, depth %d.",
|
||||
getAppearedAtChainHeight(), getDepthInBlocks()));
|
||||
break;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import com.google.common.base.Objects;
|
||||
|
||||
import java.io.*;
|
||||
import java.math.*;
|
||||
import java.util.Locale;
|
||||
|
||||
// TODO: Fix this class: should not talk about addresses, height should be optional/support mempool height etc
|
||||
|
||||
@ -156,7 +157,7 @@ public class UTXO {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("Stored TxOut of %s (%s:%d)", value.toFriendlyString(), hash, index);
|
||||
return String.format(Locale.US, "Stored TxOut of %s (%s:%d)", value.toFriendlyString(), hash, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,6 +22,7 @@ import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* A VersionMessage holds information exchanged during connection setup with another peer. Most of the fields are not
|
||||
@ -259,9 +260,9 @@ public class VersionMessage extends Message {
|
||||
checkSubVerComponent(version);
|
||||
if (comments != null) {
|
||||
checkSubVerComponent(comments);
|
||||
subVer = subVer.concat(String.format("%s:%s(%s)/", name, version, comments));
|
||||
subVer = subVer.concat(String.format(Locale.US, "%s:%s(%s)/", name, version, comments));
|
||||
} else {
|
||||
subVer = subVer.concat(String.format("%s:%s/", name, version));
|
||||
subVer = subVer.concat(String.format(Locale.US, "%s:%s/", name, version));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1617,7 +1617,7 @@ public class Wallet extends BaseTaggableObject
|
||||
Coin valueSentToMe = tx.getValueSentToMe(this);
|
||||
Coin valueSentFromMe = tx.getValueSentFromMe(this);
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info(String.format("Received a pending transaction %s that spends %s from our own wallet," +
|
||||
log.info(String.format(Locale.US, "Received a pending transaction %s that spends %s from our own wallet," +
|
||||
" and sends us %s", tx.getHashAsString(), valueSentFromMe.toFriendlyString(),
|
||||
valueSentToMe.toFriendlyString()));
|
||||
}
|
||||
@ -2943,19 +2943,19 @@ public class Wallet extends BaseTaggableObject
|
||||
StringBuilder builder = new StringBuilder();
|
||||
Coin estimatedBalance = getBalance(BalanceType.ESTIMATED);
|
||||
Coin availableBalance = getBalance(BalanceType.AVAILABLE_SPENDABLE);
|
||||
builder.append(String.format("Wallet containing %s BTC (spendable: %s BTC) in:%n",
|
||||
builder.append(String.format(Locale.US, "Wallet containing %s BTC (spendable: %s BTC) in:%n",
|
||||
estimatedBalance.toPlainString(), availableBalance.toPlainString()));
|
||||
builder.append(String.format(" %d pending transactions%n", pending.size()));
|
||||
builder.append(String.format(" %d unspent transactions%n", unspent.size()));
|
||||
builder.append(String.format(" %d spent transactions%n", spent.size()));
|
||||
builder.append(String.format(" %d dead transactions%n", dead.size()));
|
||||
builder.append(String.format(Locale.US, " %d pending transactions%n", pending.size()));
|
||||
builder.append(String.format(Locale.US, " %d unspent transactions%n", unspent.size()));
|
||||
builder.append(String.format(Locale.US, " %d spent transactions%n", spent.size()));
|
||||
builder.append(String.format(Locale.US, " %d dead transactions%n", dead.size()));
|
||||
final Date lastBlockSeenTime = getLastBlockSeenTime();
|
||||
final String lastBlockSeenTimeStr = lastBlockSeenTime == null ? "time unknown" : lastBlockSeenTime.toString();
|
||||
builder.append(String.format("Last seen best block: %d (%s): %s%n",
|
||||
builder.append(String.format(Locale.US, "Last seen best block: %d (%s): %s%n",
|
||||
getLastBlockSeenHeight(), lastBlockSeenTimeStr, getLastBlockSeenHash()));
|
||||
final KeyCrypter crypter = keyChainGroup.getKeyCrypter();
|
||||
if (crypter != null)
|
||||
builder.append(String.format("Encryption: %s%n", crypter));
|
||||
builder.append(String.format(Locale.US, "Encryption: %s%n", crypter));
|
||||
if (isWatching())
|
||||
builder.append("Wallet is watching.\n");
|
||||
|
||||
@ -2963,7 +2963,7 @@ public class Wallet extends BaseTaggableObject
|
||||
builder.append("\nKeys:\n");
|
||||
final long keyRotationTime = vKeyRotationTimestamp * 1000;
|
||||
if (keyRotationTime > 0)
|
||||
builder.append(String.format("Key rotation time: %s\n", Utils.dateTimeFormat(keyRotationTime)));
|
||||
builder.append(String.format(Locale.US, "Key rotation time: %s\n", Utils.dateTimeFormat(keyRotationTime)));
|
||||
builder.append(keyChainGroup.toString(includePrivateKeys));
|
||||
|
||||
if (!watchedScripts.isEmpty()) {
|
||||
|
@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.*;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
/**
|
||||
@ -86,7 +87,7 @@ public class DownloadProgressTracker extends AbstractPeerDataEventListener {
|
||||
* @param date the date of the last block downloaded
|
||||
*/
|
||||
protected void progress(double pct, int blocksSoFar, Date date) {
|
||||
log.info(String.format("Chain download %d%% done with %d blocks to go, block date %s", (int) pct, blocksSoFar,
|
||||
log.info(String.format(Locale.US, "Chain download %d%% done with %d blocks to go, block date %s", (int) pct, blocksSoFar,
|
||||
Utils.dateTimeFormat(date)));
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
package org.bitcoinj.crypto;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import com.google.common.primitives.Ints;
|
||||
|
||||
/**
|
||||
@ -73,7 +75,7 @@ public class ChildNumber implements Comparable<ChildNumber> {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%d%s", num(), isHardened() ? "H" : "");
|
||||
return String.format(Locale.US, "%d%s", num(), isHardened() ? "H" : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,6 +20,7 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
@ -85,7 +86,7 @@ public class DeterministicHierarchy {
|
||||
: ImmutableList.copyOf(path);
|
||||
if (!keys.containsKey(absolutePath)) {
|
||||
if (!create)
|
||||
throw new IllegalArgumentException(String.format("No key found for %s path %s.",
|
||||
throw new IllegalArgumentException(String.format(Locale.US, "No key found for %s path %s.",
|
||||
relativePath ? "relative" : "absolute", HDUtils.formatPath(path)));
|
||||
checkArgument(absolutePath.size() > 0, "Can't derive the master key: nothing to derive from.");
|
||||
DeterministicKey parent = get(absolutePath.subList(0, absolutePath.size() - 1), false, true);
|
||||
|
@ -31,6 +31,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
|
||||
@ -399,7 +400,7 @@ public class PaymentChannelServerState {
|
||||
feePaidForPayment = req.tx.getFee();
|
||||
log.info("Calculated fee is {}", feePaidForPayment);
|
||||
if (feePaidForPayment.compareTo(bestValueToMe) > 0) {
|
||||
final String msg = String.format("Had to pay more in fees (%s) than the channel was worth (%s)",
|
||||
final String msg = String.format(Locale.US, "Had to pay more in fees (%s) than the channel was worth (%s)",
|
||||
feePaidForPayment, bestValueToMe);
|
||||
throw new InsufficientMoneyException(feePaidForPayment.subtract(bestValueToMe), msg);
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
@ -371,9 +372,9 @@ class StoredClientChannel {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final String newline = String.format("%n");
|
||||
final String newline = String.format(Locale.US, "%n");
|
||||
final String closeStr = close == null ? "still open" : close.toString().replaceAll(newline, newline + " ");
|
||||
return String.format("Stored client channel for server ID %s (%s)%n" +
|
||||
return String.format(Locale.US, "Stored client channel for server ID %s (%s)%n" +
|
||||
" Key: %s%n" +
|
||||
" Value left: %s%n" +
|
||||
" Refund fees: %s%n" +
|
||||
|
@ -20,6 +20,7 @@ import org.bitcoinj.core.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
@ -103,8 +104,8 @@ public class StoredServerChannel {
|
||||
|
||||
@Override
|
||||
public synchronized String toString() {
|
||||
final String newline = String.format("%n");
|
||||
return String.format("Stored server channel (%s)%n" +
|
||||
final String newline = String.format(Locale.US, "%n");
|
||||
return String.format(Locale.US, "Stored server channel (%s)%n" +
|
||||
" Key: %s%n" +
|
||||
" Value to me: %s%n" +
|
||||
" Client output: %s%n" +
|
||||
|
@ -1215,7 +1215,7 @@ public abstract class DatabaseFullPrunedBlockStore implements FullPrunedBlockSto
|
||||
count++;
|
||||
}
|
||||
rs.close();
|
||||
System.out.printf("Settings size: %d, count: %d, average size: %f%n", size, count, (double)size/count);
|
||||
System.out.printf(Locale.US, "Settings size: %d, count: %d, average size: %f%n", size, count, (double)size/count);
|
||||
|
||||
totalSize += size; size = 0; count = 0;
|
||||
rs = s.executeQuery(getSelectHeadersDumpSQL());
|
||||
@ -1227,7 +1227,7 @@ public abstract class DatabaseFullPrunedBlockStore implements FullPrunedBlockSto
|
||||
count++;
|
||||
}
|
||||
rs.close();
|
||||
System.out.printf("Headers size: %d, count: %d, average size: %f%n", size, count, (double)size/count);
|
||||
System.out.printf(Locale.US, "Headers size: %d, count: %d, average size: %f%n", size, count, (double)size/count);
|
||||
|
||||
totalSize += size; size = 0; count = 0;
|
||||
rs = s.executeQuery(getSelectUndoableblocksDumpSQL());
|
||||
@ -1244,7 +1244,7 @@ public abstract class DatabaseFullPrunedBlockStore implements FullPrunedBlockSto
|
||||
count++;
|
||||
}
|
||||
rs.close();
|
||||
System.out.printf("Undoable Blocks size: %d, count: %d, average size: %f%n", size, count, (double)size/count);
|
||||
System.out.printf(Locale.US, "Undoable Blocks size: %d, count: %d, average size: %f%n", size, count, (double)size/count);
|
||||
|
||||
totalSize += size; size = 0; count = 0;
|
||||
long scriptSize = 0;
|
||||
@ -1259,7 +1259,7 @@ public abstract class DatabaseFullPrunedBlockStore implements FullPrunedBlockSto
|
||||
count++;
|
||||
}
|
||||
rs.close();
|
||||
System.out.printf("Open Outputs size: %d, count: %d, average size: %f, average script size: %f (%d in id indexes)%n",
|
||||
System.out.printf(Locale.US, "Open Outputs size: %d, count: %d, average size: %f, average script size: %f (%d in id indexes)%n",
|
||||
size, count, (double)size/count, (double)scriptSize/count, count * 8);
|
||||
|
||||
totalSize += size;
|
||||
|
@ -666,7 +666,7 @@ public class WalletProtobufSerializer {
|
||||
// Transaction should now be complete.
|
||||
Sha256Hash protoHash = byteStringToHash(txProto.getHash());
|
||||
if (!tx.getHash().equals(protoHash))
|
||||
throw new UnreadableWalletException(String.format("Transaction did not deserialize completely: %s vs %s", tx.getHash(), protoHash));
|
||||
throw new UnreadableWalletException(String.format(Locale.US, "Transaction did not deserialize completely: %s vs %s", tx.getHash(), protoHash));
|
||||
if (txMap.containsKey(txProto.getHash()))
|
||||
throw new UnreadableWalletException("Wallet contained duplicate transaction " + byteStringToHash(txProto.getHash()));
|
||||
txMap.put(txProto.getHash(), tx);
|
||||
@ -699,7 +699,7 @@ public class WalletProtobufSerializer {
|
||||
final ByteString spentByTransactionHash = transactionOutput.getSpentByTransactionHash();
|
||||
Transaction spendingTx = txMap.get(spentByTransactionHash);
|
||||
if (spendingTx == null) {
|
||||
throw new UnreadableWalletException(String.format("Could not connect %s to %s",
|
||||
throw new UnreadableWalletException(String.format(Locale.US, "Could not connect %s to %s",
|
||||
tx.getHashAsString(), byteStringToHash(spentByTransactionHash)));
|
||||
}
|
||||
final int spendingIndex = transactionOutput.getSpentByTransactionIndex();
|
||||
|
@ -225,9 +225,9 @@ public class BitcoinURI {
|
||||
throw new ArithmeticException("Negative coins specified");
|
||||
putWithValidation(FIELD_AMOUNT, amount);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new OptionalFieldValidationException(String.format("'%s' is not a valid amount", valueToken), e);
|
||||
throw new OptionalFieldValidationException(String.format(Locale.US, "'%s' is not a valid amount", valueToken), e);
|
||||
} catch (ArithmeticException e) {
|
||||
throw new OptionalFieldValidationException(String.format("'%s' has too many decimal places", valueToken), e);
|
||||
throw new OptionalFieldValidationException(String.format(Locale.US, "'%s' has too many decimal places", valueToken), e);
|
||||
}
|
||||
} else {
|
||||
if (nameToken.startsWith("req-")) {
|
||||
@ -257,7 +257,7 @@ public class BitcoinURI {
|
||||
*/
|
||||
private void putWithValidation(String key, Object value) throws BitcoinURIParseException {
|
||||
if (parameterMap.containsKey(key)) {
|
||||
throw new BitcoinURIParseException(String.format("'%s' is duplicated, URI is invalid", key));
|
||||
throw new BitcoinURIParseException(String.format(Locale.US, "'%s' is duplicated, URI is invalid", key));
|
||||
} else {
|
||||
parameterMap.put(key, value);
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
/**
|
||||
@ -62,7 +63,7 @@ public class BlockFileLoader implements Iterable<Block>, Iterator<Block> {
|
||||
|
||||
List<File> list = new LinkedList<File>();
|
||||
for (int i = 0; true; i++) {
|
||||
File file = new File(defaultDataDir + String.format("blk%05d.dat", i));
|
||||
File file = new File(defaultDataDir + String.format(Locale.US, "blk%05d.dat", i));
|
||||
if (!file.exists())
|
||||
break;
|
||||
list.add(file);
|
||||
|
@ -528,7 +528,7 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
|
||||
byte[] rederived = HDKeyDerivation.deriveChildKeyBytesFromPublic(parent, k.getChildNumber(), HDKeyDerivation.PublicDeriveMode.WITH_INVERSION).keyBytes;
|
||||
byte[] actual = k.getPubKey();
|
||||
if (!Arrays.equals(rederived, actual))
|
||||
throw new IllegalStateException(String.format("Bit-flip check failed: %s vs %s", Arrays.toString(rederived), Arrays.toString(actual)));
|
||||
throw new IllegalStateException(String.format(Locale.US, "Bit-flip check failed: %s vs %s", Arrays.toString(rederived), Arrays.toString(actual)));
|
||||
}
|
||||
|
||||
private void addToBasicChain(DeterministicKey key) {
|
||||
@ -1331,19 +1331,19 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
|
||||
final StringBuilder builder2 = new StringBuilder();
|
||||
if (seed != null) {
|
||||
if (seed.isEncrypted()) {
|
||||
builder2.append(String.format("Seed is encrypted%n"));
|
||||
builder2.append(String.format(Locale.US, "Seed is encrypted%n"));
|
||||
} else if (includePrivateKeys) {
|
||||
final List<String> words = seed.getMnemonicCode();
|
||||
builder2.append(
|
||||
String.format("Seed as words: %s%nSeed as hex: %s%n", Utils.join(words),
|
||||
String.format(Locale.US, "Seed as words: %s%nSeed as hex: %s%n", Utils.join(words),
|
||||
seed.toHexString())
|
||||
);
|
||||
}
|
||||
builder2.append(String.format("Seed birthday: %d [%s]%n", seed.getCreationTimeSeconds(),
|
||||
builder2.append(String.format(Locale.US, "Seed birthday: %d [%s]%n", seed.getCreationTimeSeconds(),
|
||||
Utils.dateTimeFormat(seed.getCreationTimeSeconds() * 1000)));
|
||||
}
|
||||
final DeterministicKey watchingKey = getWatchingKey();
|
||||
builder2.append(String.format("Key to watch: %s%n", watchingKey.serializePubB58(params)));
|
||||
builder2.append(String.format(Locale.US, "Key to watch: %s%n", watchingKey.serializePubB58(params)));
|
||||
formatAddresses(includePrivateKeys, params, builder2);
|
||||
return builder2.toString();
|
||||
}
|
||||
|
@ -808,7 +808,7 @@ public class KeyChainGroup implements KeyBag {
|
||||
for (DeterministicKeyChain chain : chains) {
|
||||
chainStrs.add(chain.toString(includePrivateKeys, params));
|
||||
}
|
||||
builder.append(Joiner.on(String.format("%n")).join(chainStrs));
|
||||
builder.append(Joiner.on(String.format(Locale.US, "%n")).join(chainStrs));
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@ import org.bitcoinj.script.ScriptBuilder;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@ -238,9 +239,9 @@ public class MarriedKeyChain extends DeterministicKeyChain {
|
||||
@Override
|
||||
protected void formatAddresses(boolean includePrivateKeys, NetworkParameters params, StringBuilder builder2) {
|
||||
for (DeterministicKeyChain followingChain : followingKeyChains) {
|
||||
builder2.append(String.format("Following chain: %s%n", followingChain.getWatchingKey().serializePubB58(params)));
|
||||
builder2.append(String.format(Locale.US, "Following chain: %s%n", followingChain.getWatchingKey().serializePubB58(params)));
|
||||
}
|
||||
builder2.append(String.format("%n"));
|
||||
builder2.append(String.format(Locale.US, "%n"));
|
||||
for (RedeemData redeemData : marriedKeysRedeemData.values())
|
||||
formatScript(ScriptBuilder.createP2SHOutputScript(redeemData.redeemScript), builder2, params);
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import static org.bitcoinj.core.Utils.HEX;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@ -137,7 +138,7 @@ public class BIP32Test {
|
||||
for (int i = 0; i < tv.derived.size(); i++) {
|
||||
HDWTestVector.DerivedTestCase tc = tv.derived.get(i);
|
||||
log.info("{}", tc.name);
|
||||
assertEquals(tc.name, String.format("Test%d %s", testCase + 1, tc.getPathDescription()));
|
||||
assertEquals(tc.name, String.format(Locale.US, "Test%d %s", testCase + 1, tc.getPathDescription()));
|
||||
int depth = tc.path.length - 1;
|
||||
DeterministicKey ehkey = dh.deriveChild(Arrays.asList(tc.path).subList(0, depth), false, true, tc.path[depth]);
|
||||
assertEquals(testEncode(tc.priv), testEncode(ehkey.serializePrivB58(params)));
|
||||
|
Loading…
x
Reference in New Issue
Block a user