Add issuedReceiveAddresses to AddressEntryList at wallet restore #1288

This commit is contained in:
Manfred Karrer 2018-01-26 22:07:23 -05:00
parent 020a333db1
commit da16a8169c
No known key found for this signature in database
GPG Key ID: 401250966A6B2C46

View File

@ -100,6 +100,15 @@ public final class AddressEntryList implements PersistableEnvelope, PersistedDat
} else {
list = new ArrayList<>();
add(new AddressEntry(wallet.freshReceiveKey(), AddressEntry.Context.ARBITRATOR));
// In case we restore from seed words and have balance we need to add the relevant addresses to our list:
if (wallet.getBalance().isPositive()) {
wallet.getIssuedReceiveAddresses().forEach(address -> {
log.info("Create AddressEntry for address={}", address);
add(new AddressEntry((DeterministicKey) wallet.findKeyFromPubHash(address.getHash160()), AddressEntry.Context.AVAILABLE));
});
}
persist();
}
}