loop/staticaddr/staticutil/outpoints.go
Boris Nagaev 0ee07198f6
build: update lndclient (btcd v2)
Include https://github.com/lightninglabs/lndclient/pull/280
multi: migrate to btcd v2 modules + add WalletKit.SubmitPackage

Migrate Loop imports and update Aperture and Taproot Assets to compatible
revisions so this commit remains green on its own.
2026-08-11 13:36:02 -05:00

25 lines
693 B
Go

package staticutil
import (
"fmt"
"github.com/btcsuite/btcd/wire/v2"
"github.com/lightningnetwork/lnd/lnrpc"
)
// ToWireOutpoints converts lnrpc.OutPoint protos into wire.OutPoint structs so
// they can be consumed by lower level transaction building code.
func ToWireOutpoints(outpoints []*lnrpc.OutPoint) ([]wire.OutPoint, error) {
serverOutpoints := make([]wire.OutPoint, 0, len(outpoints))
for _, o := range outpoints {
outpointStr := fmt.Sprintf("%s:%d", o.TxidStr, o.OutputIndex)
newOutpoint, err := wire.NewOutPointFromString(outpointStr)
if err != nil {
return nil, err
}
serverOutpoints = append(serverOutpoints, *newOutpoint)
}
return serverOutpoints, nil
}