mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-12-04 18:01:57 +01:00
cmd/lncli: expose bumping fee of inputs/transactions over lncli
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
@@ -17,6 +21,27 @@ func NewOutPointFromProto(op *lnrpc.OutPoint) OutPoint {
|
||||
return OutPoint(fmt.Sprintf("%v:%d", hash, op.OutputIndex))
|
||||
}
|
||||
|
||||
// NewProtoOutPoint parses an OutPoint into its corresponding lnrpc.OutPoint
|
||||
// type.
|
||||
func NewProtoOutPoint(op string) (*lnrpc.OutPoint, error) {
|
||||
parts := strings.Split(op, ":")
|
||||
if len(parts) != 2 {
|
||||
return nil, errors.New("outpoint should be of the form txid:index")
|
||||
}
|
||||
txid := parts[0]
|
||||
if hex.DecodedLen(len(txid)) != chainhash.HashSize {
|
||||
return nil, fmt.Errorf("invalid hex-encoded txid %v", txid)
|
||||
}
|
||||
outputIndex, err := strconv.Atoi(parts[1])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid output index: %v", err)
|
||||
}
|
||||
return &lnrpc.OutPoint{
|
||||
TxidStr: txid,
|
||||
OutputIndex: uint32(outputIndex),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Utxo displays information about an unspent output, including its address,
|
||||
// amount, pkscript, and confirmations.
|
||||
type Utxo struct {
|
||||
|
||||
Reference in New Issue
Block a user