Skip to content

Commit 245a666

Browse files
committed
utils: bip69 output sorting
1 parent 54652dc commit 245a666

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

utils/tx_sort.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package utils
2+
3+
import (
4+
"bytes"
5+
6+
"github.com/btcsuite/btcd/wire"
7+
)
8+
9+
// Bip69Less is taken from btcd in btcutil/txsort/txsort.go.
10+
func Bip69Less(output1, output2 *wire.TxOut) bool {
11+
if output1.Value == output2.Value {
12+
return bytes.Compare(output1.PkScript, output2.PkScript) < 0
13+
}
14+
return output1.Value < output2.Value
15+
}

0 commit comments

Comments
 (0)