mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-12 02:05:53 +00:00
Wallet extension: fix a regression introduced by e3a13a6, where in some kinds of app wallet extensions stopped being loaded properly.
This commit is contained in:
parent
dd37fe90c6
commit
0d5a542f22
@ -4049,26 +4049,21 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deserialize the wallet extension with the supplied data and add
|
* Deserialize the wallet extension with the supplied data and then install it, replacing any existing extension
|
||||||
* it to the wallet, unless there exists an extension with the
|
* that may have existed with the same ID.
|
||||||
* same id.
|
*/
|
||||||
*/
|
public void deserializeExtension(WalletExtension extension, byte[] data) throws Exception {
|
||||||
public void deserializeAndAddExtension(WalletExtension extension, byte[] data) throws Exception {
|
|
||||||
String id = checkNotNull(extension).getWalletExtensionID();
|
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
if (extensions.containsKey(id)) {
|
// This method exists partly to establish a lock ordering of wallet > extension.
|
||||||
return;
|
extension.deserializeWalletExtension(this, data);
|
||||||
} else {
|
extensions.put(extension.getWalletExtensionID(), extension);
|
||||||
extension.deserializeWalletExtension(this, data);
|
|
||||||
addExtension(extension);
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void setTag(String tag, ByteString value) {
|
public synchronized void setTag(String tag, ByteString value) {
|
||||||
super.setTag(tag, value);
|
super.setTag(tag, value);
|
||||||
|
@ -513,7 +513,7 @@ public class WalletProtobufSerializer {
|
|||||||
} else {
|
} else {
|
||||||
log.info("Loading wallet extension {}", id);
|
log.info("Loading wallet extension {}", id);
|
||||||
try {
|
try {
|
||||||
wallet.deserializeAndAddExtension(extension, extProto.getData().toByteArray());
|
wallet.deserializeExtension(extension, extProto.getData().toByteArray());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (extProto.getMandatory() && requireMandatoryExtensions) {
|
if (extProto.getMandatory() && requireMandatoryExtensions) {
|
||||||
log.error("Error whilst reading extension {}, failing to read wallet", id, e);
|
log.error("Error whilst reading extension {}, failing to read wallet", id, e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user