user100290: 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, 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?

user100290: 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 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.

100290: <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>
 100290: <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>
