Skip to content

Commit 5f969e4

Browse files
added include-spent-coins option to get_mempool_items_by_coin_name (#16)
1 parent 0330074 commit 5f969e4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

internal/cmd/coinset/get_mempool_items_by_coin_name.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@ import (
66
"github.com/spf13/cobra"
77
)
88

9+
var (
10+
getMempoolItemsByCoinNameIncludeSpentCoins bool
11+
)
12+
913
func init() {
10-
rootCmd.AddCommand(getMempoolItemsByCoinName)
14+
getMempoolItemsByCoinNameCmd.Flags().BoolVarP(&getMempoolItemsByCoinNameIncludeSpentCoins, "include-spent-coins", "s", false, "Include items no longer in the mempool")
15+
rootCmd.AddCommand(getMempoolItemsByCoinNameCmd)
1116
}
1217

13-
var getMempoolItemsByCoinName = &cobra.Command{
18+
var getMempoolItemsByCoinNameCmd = &cobra.Command{
1419
Use: "get_mempool_items_by_coin_name <coin_name>",
1520
Args: func(cmd *cobra.Command, args []string) error {
1621
if err := cobra.ExactArgs(1)(cmd, args); err != nil {
@@ -26,6 +31,9 @@ var getMempoolItemsByCoinName = &cobra.Command{
2631
Run: func(cmd *cobra.Command, args []string) {
2732
jsonData := map[string]interface{}{}
2833
jsonData["coin_name"] = formatHex(args[0])
34+
if getMempoolItemsByCoinNameIncludeSpentCoins {
35+
jsonData["include_spent_coins"] = true
36+
}
2937
makeRequest("get_mempool_items_by_coin_name", jsonData)
3038
},
3139
}

0 commit comments

Comments
 (0)