Bitcoin-ABC / ElectrumABC

Mirror of https://reviews.bitcoinabc.org/source/bitcoin-abc/browse/master/electrum/
https://bitcoinabc.org/electrum
Other
32 stars 16 forks source link

Enable ordered outputs for OP_RETURN use cases (SLP...) #298

Closed PiRK closed 1 year ago

PiRK commented 1 year ago

272 implemented shuffling of outputs in transactions, with no consideration for the type of the output.

The previous implementation before that used a deterministic sorting based on the output amount and script, which by shear luck resulted in OP_RETURN outputs always being the first output because it has a zero amount.

This PR restores this behavior of putting the OP_RETURN always first, and adds a way to keep the other outputs sorted when using OP_RETURN. This is needed for crafting SLP transactions (see https://www.youtube.com/watch?v=TU1LBd9aVlc)