mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-07 06:44:16 +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
|
||||
* it to the wallet, unless there exists an extension with the
|
||||
* same id.
|
||||
*/
|
||||
public void deserializeAndAddExtension(WalletExtension extension, byte[] data) throws Exception {
|
||||
String id = checkNotNull(extension).getWalletExtensionID();
|
||||
/**
|
||||
* Deserialize the wallet extension with the supplied data and then install it, replacing any existing extension
|
||||
* that may have existed with the same ID.
|
||||
*/
|
||||
public void deserializeExtension(WalletExtension extension, byte[] data) throws Exception {
|
||||
lock.lock();
|
||||
try {
|
||||
if (extensions.containsKey(id)) {
|
||||
return;
|
||||
} else {
|
||||
extension.deserializeWalletExtension(this, data);
|
||||
addExtension(extension);
|
||||
}
|
||||
// This method exists partly to establish a lock ordering of wallet > extension.
|
||||
extension.deserializeWalletExtension(this, data);
|
||||
extensions.put(extension.getWalletExtensionID(), extension);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public synchronized void setTag(String tag, ByteString value) {
|
||||
super.setTag(tag, value);
|
||||
|
@ -513,7 +513,7 @@ public class WalletProtobufSerializer {
|
||||
} else {
|
||||
log.info("Loading wallet extension {}", id);
|
||||
try {
|
||||
wallet.deserializeAndAddExtension(extension, extProto.getData().toByteArray());
|
||||
wallet.deserializeExtension(extension, extProto.getData().toByteArray());
|
||||
} catch (Exception e) {
|
||||
if (extProto.getMandatory() && requireMandatoryExtensions) {
|
||||
log.error("Error whilst reading extension {}, failing to read wallet", id, e);
|
||||
|
Loading…
Reference in New Issue
Block a user