3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-31 07:12:17 +00:00

Cleanup DKC serialization

This commit is contained in:
Devrandom 2014-09-30 11:17:42 -07:00 committed by Mike Hearn
parent 22f0600afe
commit 38344465f0
3 changed files with 13 additions and 11 deletions

View File

@ -680,15 +680,11 @@ public class DeterministicKeyChain implements EncryptableKeyChain {
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
protected void beforeSerializeToProtobuf(List<Protos.Key> result) {
}
@Override
public List<Protos.Key> serializeToProtobuf() {
List<Protos.Key> result = newArrayList();
lock.lock();
try {
beforeSerializeToProtobuf(result);
result.addAll(serializeMyselfToProtobuf());
} finally {
lock.unlock();

View File

@ -124,9 +124,7 @@ public class KeyChainGroup implements KeyBag {
}
}
/**
* This keeps married redeem data in sync with the number of keys issued
*/
// This keeps married redeem data in sync with the number of keys issued
private void maybeLookaheadScripts() {
for (DeterministicKeyChain chain : chains) {
chain.maybeLookAheadScripts();

View File

@ -39,6 +39,7 @@ import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.collect.Lists.newArrayList;
/**
* <p>A multi-signature keychain using synchronized HD keys (a.k.a HDM)</p>
@ -214,11 +215,18 @@ public class MarriedKeyChain extends DeterministicKeyChain {
}
@Override
protected void beforeSerializeToProtobuf(List<Protos.Key> result) {
super.beforeSerializeToProtobuf(result);
for (DeterministicKeyChain chain : followingKeyChains) {
result.addAll(chain.serializeMyselfToProtobuf());
public List<Protos.Key> serializeToProtobuf() {
List<Protos.Key> result = newArrayList();
lock.lock();
try {
for (DeterministicKeyChain chain : followingKeyChains) {
result.addAll(chain.serializeMyselfToProtobuf());
}
result.addAll(serializeMyselfToProtobuf());
} finally {
lock.unlock();
}
return result;
}
@Override