Handle encrypted BSQ wallet

This commit is contained in:
sqrrm 2019-05-28 18:27:27 +02:00
parent dcfb5faf1e
commit 78a837ec68
No known key found for this signature in database
GPG key ID: 45235F9EF87089EC
2 changed files with 4 additions and 1 deletions

View file

@ -103,6 +103,7 @@ public abstract class WalletService {
protected final CopyOnWriteArraySet<TxConfidenceListener> txConfidenceListeners = new CopyOnWriteArraySet<>(); protected final CopyOnWriteArraySet<TxConfidenceListener> txConfidenceListeners = new CopyOnWriteArraySet<>();
protected final CopyOnWriteArraySet<BalanceListener> balanceListeners = new CopyOnWriteArraySet<>(); protected final CopyOnWriteArraySet<BalanceListener> balanceListeners = new CopyOnWriteArraySet<>();
protected Wallet wallet; protected Wallet wallet;
@Getter
protected KeyParameter aesKey; protected KeyParameter aesKey;
@Getter @Getter
protected IntegerProperty chainHeightProperty = new SimpleIntegerProperty(); protected IntegerProperty chainHeightProperty = new SimpleIntegerProperty();

View file

@ -316,7 +316,9 @@ public class MyBlindVoteListService implements PersistedDataHost, DaoStateListen
// The EC key is in the blockchain already. We prefer here to stick with EC key. If any change // The EC key is in the blockchain already. We prefer here to stick with EC key. If any change
// in BitcoinJ would break our consensus we would need to fall back to the old BitcoinJ EC // in BitcoinJ would break our consensus we would need to fall back to the old BitcoinJ EC
// implementation. // implementation.
ECKey.ECDSASignature signature = key.sign(Sha256Hash.wrap(blindVoteTxId)); ECKey.ECDSASignature signature = bsqWalletService.isEncrypted() ?
key.sign(Sha256Hash.wrap(blindVoteTxId), bsqWalletService.getAesKey()) :
key.sign(Sha256Hash.wrap(blindVoteTxId));
signatureAsBytes = signature.toCanonicalised().encodeToDER(); signatureAsBytes = signature.toCanonicalised().encodeToDER();
} else { } else {
// In case we use it for requesting the currently available merit we don't apply a signature // In case we use it for requesting the currently available merit we don't apply a signature