lnwallet: finish docstrings within coin select code

This commit is contained in:
Olaoluwa Osuntokun
2016-01-02 14:09:56 -06:00
parent b2cb33c3c2
commit f257690788

View File

@@ -9,8 +9,8 @@ import (
"github.com/btcsuite/btcutil/coinset" "github.com/btcsuite/btcutil/coinset"
) )
// lnCoin... // lnCoin represents a single unspet output. Its purpose is to convert a regular
// to adhere to the coinset.Coin interface // output to a struct adhering to the coinset.Coin interface
type lnCoin struct { type lnCoin struct {
hash *wire.ShaHash hash *wire.ShaHash
index uint32 index uint32
@@ -30,7 +30,8 @@ func (l *lnCoin) ValueAge() int64 { return l.valueAge }
// Ensure lnCoin adheres to the coinset.Coin interface. // Ensure lnCoin adheres to the coinset.Coin interface.
var _ coinset.Coin = (*lnCoin)(nil) var _ coinset.Coin = (*lnCoin)(nil)
// newLnCoin... // newLnCoin creates a new "coin" from the passed output. Coins are required
// in order to perform coin selection upon.
func newLnCoin(output *btcjson.ListUnspentResult) (coinset.Coin, error) { func newLnCoin(output *btcjson.ListUnspentResult) (coinset.Coin, error) {
txid, err := wire.NewShaHashFromStr(output.TxID) txid, err := wire.NewShaHashFromStr(output.TxID)
if err != nil { if err != nil {
@@ -55,7 +56,8 @@ func newLnCoin(output *btcjson.ListUnspentResult) (coinset.Coin, error) {
}, nil }, nil
} }
// outputsToCoins... // outputsToCoins converts a slice of transaction outputs to a coin-selectable
// slice of "Coins"s.
func outputsToCoins(outputs []*btcjson.ListUnspentResult) ([]coinset.Coin, error) { func outputsToCoins(outputs []*btcjson.ListUnspentResult) ([]coinset.Coin, error) {
coins := make([]coinset.Coin, len(outputs)) coins := make([]coinset.Coin, len(outputs))
for i, output := range outputs { for i, output := range outputs {