mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2026-07-30 19:46:16 +00:00
prevent tweakless address nodes in sp wallets
This commit is contained in:
+1
-1
Submodule drongo updated: c87d5cc3c2...29cd4b7909
@@ -1566,12 +1566,13 @@ public class ElectrumServer {
|
||||
|
||||
private WalletNode createNodeForMatch(Wallet wallet, SilentPaymentScanMatch match, Map<Address, WalletNode> walletAddresses, KeyPurpose purpose, int newIndex) {
|
||||
WalletNode purposeNode = wallet.getNode(purpose);
|
||||
Set<WalletNode> created = purposeNode.fillToIndex(wallet, newIndex);
|
||||
WalletNode addressNode = created.stream().filter(n -> n.getIndex() == newIndex).findFirst().orElseThrow(() -> new IllegalStateException("fillToIndex did not create node at index " + newIndex));
|
||||
addressNode.setSilentPaymentTweak(match.tweak());
|
||||
WalletNode addressNode = purposeNode.addSilentPaymentChild(wallet, newIndex, match.tweak());
|
||||
if(addressNode == null) {
|
||||
throw new IllegalStateException("Silent payment child already exists at index " + newIndex);
|
||||
}
|
||||
|
||||
if(walletAddresses.containsKey(wallet.getAddress(addressNode))) {
|
||||
purposeNode.getChildren().removeAll(created);
|
||||
purposeNode.getChildren().remove(addressNode);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user