decred / dcrd

Decred daemon in Go (golang).
https://decred.org
ISC License
731 stars 288 forks source link

mixclient: Respect standard tx size limits #3338

Closed jrick closed 3 months ago

jrick commented 3 months ago

In order to meet the standard tx size requirements on mainnet, peers who contribute too much to the coinjoin transaction size must be excluded from the current run before the pairing is finalized. Failing to do so will only result in a transaction that fails to publish if all peers continue the mix to completion.

Exclusion is performed by iterating all current PRs in the random order determined by the set of all PRs and the current epoch. A fake coinjoin transaction which is only meant to measure the expected tx size is added to only if that peer does not overcontribute to the size. The random peer order is sufficient to prevent this algorithm from being gamed.

Any peers that become excluded will attempt a mix again in the following epoch. While it could be possible, we do not currently run multiple mixes for the same pairing type by splitting the PR set into two or more sets.

jrick commented 3 months ago

That limits.go code (which was borrowed from csppserver) needs some fixes. It is not dealing properly with the added opcode byte for spending stake tree outputs. Will revise.