<p>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 <code>walletcreatefundedpsbt</code> or <code>fundrawtransaction</code>.</p>

<p>For a code reference, the <a href="https://github.com/bitcoin/bitcoin/blob/master/src/wallet/wallet.cpp#L2426" rel="nofollow noreferrer"><code>AvailableCoins</code> function</a> is used to fetch and filter the coins available for coin selection which <a href="https://github.com/bitcoin/bitcoin/blob/master/src/wallet/wallet.cpp#L2457" rel="nofollow noreferrer">calls</a> the <a href="https://github.com/bitcoin/bitcoin/blob/master/src/wallet/wallet.cpp#L2277" rel="nofollow noreferrer"><code>IsTrusted</code></a> 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 <code>IsTrusted</code> returns false which results in <code>AvailableCoins</code> excluding all of that transaction's outputs from the set of outputs used for coin selection.</p>

CC BY-SA 4.0
2019-07-14T05:44:59.857Z
2019-07-14T05:44:59.857Z
Ava Chow
<p>I would like to create a psbt using <code>walletcreatefundedpsbt</code> spending unconfirmed ouptputs. Is this possible?</p>

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

<p>Thanks in advance!</p>

CC BY-SA 4.0
2019-07-14T04:38:23.897Z
Are the unconfirmed inputs from incoming outputs or change outputs? If they are incoming, Bitcoin Core will not select them for transactions.
Ava Chow
CC BY-SA 4.0
2019-07-14T05:24:16.637Z
Incoming. Is it true that Bitcoin Core's coin selection algorithm won't select unconfirmed incoming outputs in general?
justinmoon
<json-rpc><bip174-psbt>
`walletcreatefundedpsbt` with unconfirmed inputs
justinmoon
# `walletcreatefundedpsbt` with unconfirmed inputs

(Asked by: username_0 on 2019-07-14)

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!

**Tags:** json-rpc, bip174-psbt

> **Comments:**
> **username_1**: Are the unconfirmed inputs from incoming outputs or change outputs? If they are incoming, Bitcoin Core will not select them for transactions.  
> **username_0**: Incoming. Is it true that Bitcoin Core's coin selection algorithm won't select unconfirmed incoming outputs in general?  

---

## 1 answers

### Answer by username_1 on 2019-07-14. Score: 2 | Accepted answer

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](https://github.com/bitcoin/bitcoin/blob/master/src/wallet/wallet.cpp#L2426) is used to fetch and filter the coins available for coin selection which [calls](https://github.com/bitcoin/bitcoin/blob/master/src/wallet/wallet.cpp#L2457) the [`IsTrusted`](https://github.com/bitcoin/bitcoin/blob/master/src/wallet/wallet.cpp#L2277) 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.


---

