e0e9257790
- Move hex for test txns into separate files in the testdata directory - Convert tests to table-driven tests - Make comments more consistent with the rest of the codebase - Optimize the input sorting function to perform the hash equivalence check before reversing the bytes so it can be avoided in that case |
||
---|---|---|
.. | ||
testdata | ||
doc.go | ||
README.md | ||
txsort.go | ||
txsort_test.go |
txsort
[] (https://travis-ci.org/btcsuite/btcutil) ![ISC License] (http://img.shields.io/badge/license-ISC-blue.svg)
Package txsort provides the transaction sorting according to BIPLI01.
BIPLI01 defines a standard lexicographical sort order of transaction inputs and outputs. This is useful to standardize transactions for faster multi-party agreement as well as preventing information leaks in a single-party use case.
The BIP goes into more detail, but for a quick and simplistic overview, the order for inputs is defined as first sorting on the previous output hash and then on the index as a tie breaker. The order for outputs is defined as first sorting on the amount and then on the raw public key script bytes as a tie breaker.
A comprehensive suite of tests is provided to ensure proper functionality.
Documentation
[] (http://godoc.org/github.com/btcsuite/btcutil/txsort)
Full go doc
style documentation for the project can be viewed online without
installing this package by using the GoDoc site here:
http://godoc.org/github.com/btcsuite/btcutil/txsort
You can also view the documentation locally once the package is installed with
the godoc
tool by running godoc -http=":6060"
and pointing your browser to
http://localhost:6060/pkg/github.com/btcsuite/btcutil/txsort
Installation and Updating
$ go get -u github.com/btcsuite/btcutil/txsort
License
Package txsort is licensed under the copyfree ISC License.