mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-02 05:27:17 +00:00
BasicKeyChain: Extract toString() from KeyChainGroup.
This commit is contained in:
@@ -18,6 +18,7 @@ package org.bitcoinj.wallet;
|
||||
|
||||
import org.bitcoinj.core.BloomFilter;
|
||||
import org.bitcoinj.core.ECKey;
|
||||
import org.bitcoinj.core.NetworkParameters;
|
||||
import org.bitcoinj.crypto.*;
|
||||
import org.bitcoinj.utils.ListenerRegistration;
|
||||
import org.bitcoinj.utils.Threading;
|
||||
@@ -618,4 +619,13 @@ public class BasicKeyChain implements EncryptableKeyChain {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public String toString(boolean includePrivateKeys, @Nullable KeyParameter aesKey, NetworkParameters params) {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
List<ECKey> keys = getKeys();
|
||||
Collections.sort(keys, ECKey.AGE_COMPARATOR);
|
||||
for (ECKey key : keys)
|
||||
key.formatKeyWithAddress(includePrivateKeys, aesKey, builder, params);
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -814,12 +814,8 @@ public class KeyChainGroup implements KeyBag {
|
||||
|
||||
public String toString(boolean includePrivateKeys, @Nullable KeyParameter aesKey) {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
if (basic != null) {
|
||||
List<ECKey> keys = basic.getKeys();
|
||||
Collections.sort(keys, ECKey.AGE_COMPARATOR);
|
||||
for (ECKey key : keys)
|
||||
key.formatKeyWithAddress(includePrivateKeys, aesKey, builder, params);
|
||||
}
|
||||
if (basic != null)
|
||||
builder.append(basic.toString(includePrivateKeys, aesKey, params));
|
||||
for (DeterministicKeyChain chain : chains)
|
||||
builder.append(chain.toString(includePrivateKeys, aesKey, params)).append('\n');
|
||||
return builder.toString();
|
||||
|
||||
Reference in New Issue
Block a user