From 7535c876bad20a82b0ef4635e97d1528d58c4ba7 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Wed, 25 May 2022 16:14:26 +0200 Subject: [PATCH] ensure dummy y value of taproot internal key is consistent --- src/main/java/com/sparrowwallet/drongo/psbt/PSBTInput.java | 4 ++-- src/main/java/com/sparrowwallet/drongo/psbt/PSBTOutput.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/sparrowwallet/drongo/psbt/PSBTInput.java b/src/main/java/com/sparrowwallet/drongo/psbt/PSBTInput.java index 7acc0c1..66110ea 100644 --- a/src/main/java/com/sparrowwallet/drongo/psbt/PSBTInput.java +++ b/src/main/java/com/sparrowwallet/drongo/psbt/PSBTInput.java @@ -82,11 +82,11 @@ public class PSBTInput { this.proprietary.putAll(proprietary); - this.tapInternalKey = tapInternalKey; + this.tapInternalKey = tapInternalKey == null ? null : ECKey.fromPublicOnly(tapInternalKey.getPubKeyXCoord()); if(tapInternalKey != null && !derivedPublicKeys.values().isEmpty()) { KeyDerivation tapKeyDerivation = derivedPublicKeys.values().iterator().next(); - tapDerivedPublicKeys.put(tapInternalKey, Map.of(tapKeyDerivation, Collections.emptyList())); + tapDerivedPublicKeys.put(this.tapInternalKey, Map.of(tapKeyDerivation, Collections.emptyList())); } this.sigHash = getDefaultSigHash(); diff --git a/src/main/java/com/sparrowwallet/drongo/psbt/PSBTOutput.java b/src/main/java/com/sparrowwallet/drongo/psbt/PSBTOutput.java index df19680..fb10a71 100644 --- a/src/main/java/com/sparrowwallet/drongo/psbt/PSBTOutput.java +++ b/src/main/java/com/sparrowwallet/drongo/psbt/PSBTOutput.java @@ -45,11 +45,11 @@ public class PSBTOutput { this.proprietary.putAll(proprietary); - this.tapInternalKey = tapInternalKey; + this.tapInternalKey = tapInternalKey == null ? null : ECKey.fromPublicOnly(tapInternalKey.getPubKeyXCoord()); if(tapInternalKey != null && !derivedPublicKeys.values().isEmpty()) { KeyDerivation tapKeyDerivation = derivedPublicKeys.values().iterator().next(); - tapDerivedPublicKeys.put(tapInternalKey, Map.of(tapKeyDerivation, Collections.emptyList())); + tapDerivedPublicKeys.put(this.tapInternalKey, Map.of(tapKeyDerivation, Collections.emptyList())); } }