cmd/lncli/commands: filter txid_bytes from list_unspent
This commit is contained in:
parent
b25f1af347
commit
4c632627ae
@ -340,11 +340,26 @@ func listUnspent(ctx *cli.Context) error {
|
|||||||
MinConfs: int32(minConfirms),
|
MinConfs: int32(minConfirms),
|
||||||
MaxConfs: int32(maxConfirms),
|
MaxConfs: int32(maxConfirms),
|
||||||
}
|
}
|
||||||
jsonResponse, err := client.ListUnspent(ctxb, req)
|
resp, err := client.ListUnspent(ctxb, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
printRespJSON(jsonResponse)
|
|
||||||
|
// Parse the response into the final json object that will be printed
|
||||||
|
// to stdout. At the moment, this filters out the raw txid bytes from
|
||||||
|
// each utxo's outpoint and only prints the txid string.
|
||||||
|
var listUnspentResp = struct {
|
||||||
|
Utxos []*Utxo `json:"utxos"`
|
||||||
|
}{
|
||||||
|
Utxos: make([]*Utxo, 0, len(resp.Utxos)),
|
||||||
|
}
|
||||||
|
for _, protoUtxo := range resp.Utxos {
|
||||||
|
utxo := NewUtxoFromProto(protoUtxo)
|
||||||
|
listUnspentResp.Utxos = append(listUnspentResp.Utxos, utxo)
|
||||||
|
}
|
||||||
|
|
||||||
|
printJSON(listUnspentResp)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user