mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
utils: bip69 output sorting
This commit is contained in:
parent
54652dc641
commit
245a66610b
1 changed files with 15 additions and 0 deletions
15
utils/tx_sort.go
Normal file
15
utils/tx_sort.go
Normal 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
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue