2

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?

1

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.

| improve this answer | |

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.