utils: bip69 output sorting

This commit is contained in:
Slyghtning 2025-07-29 18:02:57 +02:00
parent 54652dc641
commit 245a66610b
No known key found for this signature in database
GPG key ID: F82D456EA023C9BF

15
utils/tx_sort.go Normal file
View file

@ -0,0 +1,15 @@
package utils
import (
"bytes"
"github.com/btcsuite/btcd/wire"
)
// Bip69Less is taken from btcd in btcutil/txsort/txsort.go.
func Bip69Less(output1, output2 *wire.TxOut) bool {
if output1.Value == output2.Value {
return bytes.Compare(output1.PkScript, output2.PkScript) < 0
}
return output1.Value < output2.Value
}