prevent tweakless address nodes in sp wallets

This commit is contained in:
Craig Raw
2026-05-08 09:27:08 +02:00
parent 201d4b8376
commit 9b12361724
2 changed files with 6 additions and 5 deletions
+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;
}