mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-28 23:16:35 +01:00
cmd/lncli: properly reverse user txid input
This commit fixes a bug introduced within a prior commit. The prior commit failed to drollery reverse the txid string taken in as user input, therefore in order to properly close a channel, the user needed to manually reverse the txid themselves. With this change, `wire.NewShaHashFromStr` is used which properly reverses the string within the constructor. This allows the string reported not be directly used to the close an active channel. This commit also corrects a few logging messages.
This commit is contained in:
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
@@ -222,14 +221,14 @@ func closeChannel(ctx *cli.Context) {
|
||||
ctxb := context.Background()
|
||||
client := getClient(ctx)
|
||||
|
||||
txid, err := hex.DecodeString(ctx.String("funding_txid"))
|
||||
txid, err := wire.NewShaHashFromStr(ctx.String("funding_txid"))
|
||||
if err != nil {
|
||||
fatal(err)
|
||||
}
|
||||
|
||||
req := &lnrpc.CloseChannelRequest{
|
||||
ChannelPoint: &lnrpc.ChannelPoint{
|
||||
FundingTxid: txid,
|
||||
FundingTxid: txid[:],
|
||||
OutputIndex: uint32(ctx.Int("output_index")),
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user