mirror of
https://github.com/sparrowwallet/drongo.git
synced 2025-11-05 11:56:38 +00:00
improve pubkey checks to consider just x-only and compressed keys
This commit is contained in:
parent
68966e5c26
commit
a4d86f9ee3
1 changed files with 6 additions and 3 deletions
|
|
@ -46,17 +46,20 @@ public class SilentPaymentUtils {
|
|||
if(scriptType.isScriptType(output.getScript())) {
|
||||
switch(scriptType) {
|
||||
case P2TR:
|
||||
keys.add(output.getScript().getPubKey());
|
||||
keys.add(ScriptType.P2TR.getPublicKeyFromScript(output.getScript()));
|
||||
break;
|
||||
case P2WPKH:
|
||||
case P2SH_P2WPKH:
|
||||
if(input.getWitness() != null && input.getWitness().getPushCount() == 2) {
|
||||
keys.add(ECKey.fromPublicOnly(input.getWitness().getPushes().get(input.getWitness().getPushCount() - 1)));
|
||||
byte[] pubKey = input.getWitness().getPushes().get(input.getWitness().getPushCount() - 1);
|
||||
if(pubKey != null && pubKey.length == 33) {
|
||||
keys.add(ECKey.fromPublicOnly(pubKey));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case P2PKH:
|
||||
for(ScriptChunk scriptChunk : input.getScriptSig().getChunks()) {
|
||||
if(scriptChunk.isPubKey()) {
|
||||
if(scriptChunk.isPubKey() && scriptChunk.getData().length == 33) {
|
||||
keys.add(scriptChunk.getPubKey());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue