Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

signpsbt do not allow to sign an utxo already spent in an unconfirmed transaction #1679

Open
divoc91ab opened this issue Mar 1, 2024 · 1 comment

Comments

@divoc91ab
Copy link

wallet-tool.py signpsbt do not allow the signing of a transaction spending an utxo spent in another unconfirmed transaction.

The psbt is correctly parsed but The PSBT is not yet fully signed, we signed: 0 inputs. is the result of the script.

Version 0.9.11
(It is the first issue that I open, so if it is missing any detail let me know)

@kristapsk
Copy link
Member

According to code, signing PSBT that double spends wallet input in a new transaction that conflicts with another unconfirmed transaction from mempool should work ("utxos that we've stopped tracking"). Probably there is some bug or edge case.

# in the rare situation that we want to sign a psbt using private keys
# to utxos that we've stopped tracking, let's also find inputs that
# belong to us and add those private keys as well
for vin in new_psbt.inputs:
try:
path = self.script_to_path(vin.utxo.scriptPubKey)
key = self._get_key_from_path(path)
if key not in privkeys:
privkeys.append(key)
except AssertionError:
# we can safely assume that an exception means we do not
# have the ability to sign for this input
continue
except AttributeError:
# shouldn't happen for properly constructed psbts
# however, psbts with no utxo information will raise
# an AttributeError exception. we simply ignore it.
continue

@kristapsk kristapsk changed the title signpsbt do not allow to sign an utxo already spent in an unconfirmed transuction signpsbt do not allow to sign an utxo already spent in an unconfirmed transaction Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants