<p>I just realized that there are in fact these two lines which takes into account the size of CTxOut:</p>

<pre><code>size_t nSize = GetSerializeSize(txout);
...
...
nSize += (32 + 4 + 1 + (107 / WITNESS_SCALE_FACTOR) + 4);
</code></pre>

<p>so based on this, a p2wsh output (43 bytes) would have a dust limit of:</p>

<p>= 43 + (32 + 4 + 1 + (107 / WITNESS_SCALE_FACTOR) + 4)<br>
= 110 bytes</p>

<p>then using the <a href="https://github.com/bitcoin/bitcoin/blob/0.19/src/policy/policy.h#L50" rel="nofollow noreferrer">current dust_relay_tx_fee</a> of 3000 sat/kilobyte (or 3 sat/byte),</p>

<p>110 bytes * 3 sat/byte = 330 satoshis</p>

<p>Therefore, p2wsh outputs with less than 330 satoshis will be considered non-standard and will be rejected.</p>

CC BY-SA 4.0
2020-04-28T21:41:48.940Z
2020-04-29T00:27:11.777Z
2020-04-29T00:27:11.777Z
Darius
<p>I've seen mentioned in a few places that the dust limit for an output to be considered standard is minRelayTxFee*3. Based on this, I would expect the dust limit for a p2wsh output to be larger than for a p2wpkh, since CTxOut for p2wsh is larger (43 bytes versus 31 bytes).</p>

<p>However, when I look at the <a href="https://github.com/bitcoin/bitcoin/blob/c536dfbcb00fb15963bf5d507b7017c241718bf6/src/policy/policy.cpp#L18" rel="nofollow noreferrer">code in policy.cpp</a>, it seems to only care about whether the output follows a witness program, and not whether it is p2wpkh or p2wsh. So does that mean the dust limit for a p2wsh output is also 294 satoshis?</p>

<bitcoin-core><dust><p2wpkh><p2wsh>
Is the dust output limit the same for p2wpkh and p2wsh?
Darius
# Is the dust output limit the same for p2wpkh and p2wsh?

(Asked by: username_0 on 2020-04-28)

I've seen mentioned in a few places that the dust limit for an output to be considered standard is minRelayTxFee\*3. Based on this, I would expect the dust limit for a p2wsh output to be larger than for a p2wpkh, since CTxOut for p2wsh is larger (43 bytes versus 31 bytes).

However, when I look at the [code in policy.cpp](https://github.com/bitcoin/bitcoin/blob/c536dfbcb00fb15963bf5d507b7017c241718bf6/src/policy/policy.cpp#L18), it seems to only care about whether the output follows a witness program, and not whether it is p2wpkh or p2wsh. So does that mean the dust limit for a p2wsh output is also 294 satoshis?

**Tags:** bitcoin-core, dust, p2wpkh, p2wsh


---

## 1 answers

### Answer by username_0 on 2020-04-28. Score: 1 | Accepted answer

I just realized that there are in fact these two lines which takes into account the size of CTxOut:

```
size_t nSize = GetSerializeSize(txout);
...
...
nSize += (32 + 4 + 1 + (107 / WITNESS_SCALE_FACTOR) + 4);

```

so based on this, a p2wsh output (43 bytes) would have a dust limit of:

= 43 + (32 + 4 + 1 + (107 / WITNESS\_SCALE\_FACTOR) + 4)  
= 110 bytes

then using the [current dust\_relay\_tx\_fee](https://github.com/bitcoin/bitcoin/blob/0.19/src/policy/policy.h#L50) of 3000 sat/kilobyte (or 3 sat/byte),

110 bytes \* 3 sat/byte = 330 satoshis

Therefore, p2wsh outputs with less than 330 satoshis will be considered non-standard and will be rejected.


---

