1

I would like to create a psbt using walletcreatefundedpsbt spending unconfirmed ouptputs. Is this possible?

When I call that RPC command with 0 confirmed balance but with sufficient unconfirmed outputs, I get an Insufficient funds error.

Thanks in advance!

  • Are the unconfirmed inputs from incoming outputs or change outputs? If they are incoming, Bitcoin Core will not select them for transactions. – Andrew Chow Jul 14 at 4:38
  • Incoming. Is it true that Bitcoin Core's coin selection algorithm won't select unconfirmed incoming outputs in general? – justinmoon Jul 14 at 5:24
2

Bitcoin Core will never select unconfirmed incoming outputs. These are always considered to be untrusted and not safe for coin selection. This applies to any transactions that Bitcoin Core creates, including those created by using walletcreatefundedpsbt or fundrawtransaction.

For a code reference, the AvailableCoins function is used to fetch and filter the coins available for coin selection which calls the IsTrusted function for every available output (well really transaction stored in the wallet which include incoming and outgoing transactions). If the transaction was not created by that wallet, it is considered not trusted, so IsTrusted returns false which results in AvailableCoins excluding all of that transaction's outputs from the set of outputs used for coin selection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.