Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listfunds: Moved from array of struct to array of pointers. #34

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions glightning/lightning.go
Original file line number Diff line number Diff line change
Expand Up @@ -2141,9 +2141,9 @@ type Forwarding struct {
}

// List all forwarded payments and their information
func (l *Lightning) ListForwards() ([]Forwarding, error) {
func (l *Lightning) ListForwards() ([]*Forwarding, error) {
var result struct {
Forwards []Forwarding `json:"forwards"`
Forwards []*Forwarding `json:"forwards"`
}
err := l.client.Request(&ListForwardsRequest{}, &result)
return result.Forwards, err
Expand Down
16 changes: 16 additions & 0 deletions glightning/tests/interop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,22 @@ func TestListTransactions(t *testing.T) {
assert.Equal(t, len(trans), 2)
}

func TestListFunds(t *testing.T) {
short(t)

testDir, dataDir, btcPid, btc := Init(t)
defer CleanUp(testDir)
l1 := LnNode(t, testDir, dataDir, btcPid, "one", nil)

fundNode(t, "1.0", l1, btc)
fundNode(t, "1.0", l1, btc)
waitToSync(l1)
funds, err := l1.rpc.ListFunds()
check(t, err)
assert.Equal(t, len(funds.Channels), 0)
}


func fundNode(t *testing.T, amount string, n *Node, b *gbitcoin.Bitcoin) {
addr, err := n.rpc.NewAddr()
check(t, err)
Expand Down
3 changes: 2 additions & 1 deletion jrpc2/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"log"
"os"
"fmt"
"sync"
"testing"
"time"
Expand Down Expand Up @@ -110,7 +111,7 @@ func (s *ServerSubtractString) New() interface{} {
}

func (s *ServerSubtractString) Call() (jrpc2.Result, error) {
return string(s.Minuend - s.Subtrahend), nil
return fmt.Sprintf("%d", (s.Minuend - s.Subtrahend)), nil
}

// send a response with a result of a different type than
Expand Down