import { HashByteOrder } from "./HashByteOrder" ; import { TxIn } from "./TxIn" ; import { TxOut } from "./TxOut" ; param a param b export function bip69InputSorter ( a , b ) { const txid = a . outpoint . txid . serialize ( HashByteOrder . RPC ) . compare ( b . outpoint . txid . serialize ( ) ) ; if ( txid !== 0 ) return txid ; if ( a . outpoint . outputIndex < b . outpoint . outputIndex ) return - 1 ; if ( a . outpoint . outputIndex > b . outpoint . outputIndex ) return 1 ; return 0 ; } param a param b export function bip69OutputSorter ( a , b ) { const amount = Number ( a . value . sats - b . value . sats ) ; if ( amount !== 0 ) return amount ; return a . scriptPubKey . serializeCmds ( ) . compare ( b . scriptPubKey . serializeCmds ( ) ) ; }