Commit Graph

29 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
e910b12d33
lnd: fix issues reported by golint+govet
github.com/lightningnetwork/lnd  master ✗

                                           0m ◒
▶ golint
htlcswitch.go:292:4: should replace numUpdates += 1 with numUpdates++
htlcswitch.go:554:6: var onionId should be onionID
htlcswitch.go:629:7: var onionId should be onionID
lnd_test.go:133:1: context.Context should be the first parameter of a
function
lnd_test.go:177:1: context.Context should be the first parameter of a
function
networktest.go:84:2: struct field nodeId should be nodeID
peer.go:1704:16: should omit 2nd value from range; this loop is
equivalent to `for invoice := range ...`
rpcserver.go:57:6: func newRpcServer should be newRPCServer

github.com/lightningnetwork/lnd  master ✗

                                        9m ⚑ ◒  ⍉
▶ go vet
features.go:12: github.com/lightningnetwork/lnd/lnwire.Feature
composite literal uses unkeyed fields
fundingmanager.go:380: no formatting directive in Errorf call
exit status 1
2017-02-22 14:58:37 -08:00
Olaoluwa Osuntokun
384fe61e73
multi: fix go vet warnings throughout code base 2017-02-16 19:33:19 +08:00
Andrey Samokhvalov
51d53eab32 test: fix typos 2017-01-12 16:43:55 -08:00
Olaoluwa Osuntokun
9ccf9947a2
test: add ability to push funds during funding to OpenChannel
This commit adds support for pushing funds during the funding process
to the helper method in the integration testing framework.

Additionally, we also modify the simple testBasicChannelFunding test to
also push over an amount in order to test the functionality within the
daemon.
2017-01-09 19:34:28 -08:00
Olaoluwa Osuntokun
5affed38fc
multi: update btcsuite API's to latest upstream changes
This commit makes a large number of minor changes concerning API usage
within the deamon to match the latest version on the upstream btcsuite
libraries.

The major changes are the switch from wire.ShaHash to chainhash.Hash,
and that wire.NewMsgTx() now takes a paramter indicating the version of
the transaction to be created.
2017-01-05 13:56:34 -08:00
Olaoluwa Osuntokun
ad76899a57
config+test: use default port for RPC server if one isn't specified
This commit alters the configuration parsing a bit along with the
documentation to expect the RPCHost configuration paramter to also have
the target port specified. If the port isn’t included, then the default
btcd RPC port for that chain is used.

Additionally, within the integration testing framework, when creating
the lnd nodes, we now use the configuration from the btcd harness to
set the proper RPC host.
2017-01-05 13:18:26 -08:00
bryanvu
aa04f82a15 utxonursery: added persistence to transaction output states
Moved transaction states from in-memory maps to persistent BoltDB
buckets. This allows channel force closes to operate reliably if the
daemon is shut down and restarted at any point during the forced
channel closure process.
2017-01-03 16:23:07 -08:00
Olaoluwa Osuntokun
5a678d5beb
test: add a callback to networkHarness.RestartNode
This commit adds a callback to the RestartNode method on the network
harness in order to allow test authors to execute arbitrary logic
in-between the restart process for the node.
2016-11-21 21:08:52 -06:00
Olaoluwa Osuntokun
c31c980f82
netharness: properly return all errors during lightningNode.start() 2016-11-16 12:44:43 -08:00
Olaoluwa Osuntokun
39c279b639
test: add ability to networkHarness to cause an arbitrary node to restart
This commit adds a new feature to the network harness: test writers are
now able to select arbitrary nodes, causing them to restart.

This functionality will be useful in the future in order to test
scenarios like persisting data across restarts, re-syncing after
re-connections, reacting to the counter party broadcasting revoked
states, etc.
2016-11-14 15:49:09 -08:00
Olaoluwa Osuntokun
474f0afceb
test: convert network harness RPC methods to use node pubkeys 2016-10-27 19:43:36 -07:00
Olaoluwa Osuntokun
a7b7f4f272
test: fix double close channel bug by removing wait in lightningNode.stop()
This commit fixes a panic bug caused by two calls to a process’
cmd.Wait() method. If two nodes incurred a fatal error as soon as they
were created, then both the goroutine detected to recovering the stderr
data and the defer statement would case a double channel close due to
the simultaneous calls to Wait().
2016-10-23 19:27:32 -07:00
Olaoluwa Osuntokun
517255fdb1
test: rename CT to harnessTest, ensure all RPC's get distinct timeouts
This commit slightly modifies the existing CT struct in order to
maintain consistency with code-style. As a result of the name change,
all references have also been renamed from `ct` to `t`.

The Error and Errorf methods have been removed in favor of forcing
everything to be reported via `Fatalf`. Additionally a new method
(ProcessErrors) has been introduced to the networkHarness class in
order to encapsulate the underlying channel.
2016-10-23 19:27:24 -07:00
Andrey Samokhvalov
e6f45a948e testing: add CT (Custom Testing) structure; create uniq point for 'lnd process errors' and 'test panic/failed errors' handling 2016-10-22 02:11:12 +03:00
Andrey Samokhvalov
14c6770b76 general: fix typos 2016-10-22 01:48:05 +03:00
Olaoluwa Osuntokun
6c51bc7cee
test: block with a timeout within SendCoins ensuring proper balance after send 2016-09-26 11:54:19 -07:00
Olaoluwa Osuntokun
2ed510d1d9
test: eliminate panics on RPC call errors 2016-09-26 10:52:33 -07:00
Olaoluwa Osuntokun
9bb917cd2a
test: add methods for connecting nodes, funding the wallet of nodes 2016-09-26 10:31:23 -07:00
Olaoluwa Osuntokun
50e7cbe3be
test: add ability to add additional nodes to the test network 2016-09-26 10:30:29 -07:00
Olaoluwa Osuntokun
d9c0e6653f
test: extract the identity pubkey of running lnd nodes into the lightningNode struct 2016-09-26 10:29:21 -07:00
Olaoluwa Osuntokun
28b72d368c
test: use context.WithTimeout to ensure async tests don't block indefinitely
This commit uses the context package’s WithTimeout to ensure tests
which rely on asynchrony behaviors cannot block the execution of the
integration tests for ever. All tests which rely on async gRPC
notifications now perform a 3 way select: on the timeout channel
closure, an error, and the response itself.

Additionally some slight refactoring has taken place within the current
set of integration tests, eliminating some unneeded factory functions.
2016-09-21 19:45:54 -07:00
andrew.shvv
2788dbeaa8 Add RPC to show current total available channel capacity #29 (#35)
This commit adds a new RPC command: `channelbalance` which returns the
sum of all available channel capacity across all open channels. The
total balance is currently returned in units of `satoshis`. Additionally
the `networkHarness` has been modified slightly to allow specifying the
additional "extra" command line parameters when creating the initial
seed nodes. Minor refactoring within the integration tests has been
undertaken in order to increase code re-use across tests.

Closes #29.
2016-09-15 12:00:56 -07:00
Olaoluwa Osuntokun
d23bf8b633
test: properly mark txid's as seen within the networkWatcher 2016-09-13 18:56:40 -07:00
Olaoluwa Osuntokun
668063f61d
test: modify the networkHarness' OpenChannel method to use global IDs
This commit modifies the OpenChannel helper method within the
networkHarness to open the channel according to the destination node’s
global lighting ID rather than using a hard coded peer ID as before.

With this change the method is now much more general as the prior
temporary hack has been removed.
2016-09-13 15:38:45 -07:00
Olaoluwa Osuntokun
d0353b2864
lnwallet: add ability to trigger a force closure within channel state machine
This commit introduces the concept of a manually initiated “force”
closer within the channel state machine. A force closure is a closure
initiated by a  local subsystem which broadcasts the current commitment
state directly on-chain rather than attempting to cooperatively
negotiate a closure with the remote party.

A force closure returns a ForceCloseSummary which includes all the
details required for claiming all rightfully owned outputs within the
broadcast commitment transaction.

Additionally two new publicly exported channels are introduced, one
which is closed due a locally initiated force closure, and the other
which is closed once we detect that the remote party has executed a
unilateral closure by broadcasting their version of the commitment
transaction.
2016-09-12 19:07:35 -07:00
Olaoluwa Osuntokun
d2acb4336c
test: add method to dump logs of a node within the networkHarness
At times when testing one requires access to the logs of a particular
node in order to aide with debugging. Before this commit, one needed to
manually modify the networkHarness code in order to print either the
location of the logs or the logs themselves. With this commit, tests
can now programmatically examine the logs of any node created within
the networkHarness.

It’s worth noting that at times the logs dumped may not be the most up
to date version of the logs files as the logging library employs
intermediate buffering.
2016-09-10 13:14:33 -07:00
Olaoluwa Osuntokun
d764493d25
test: fix basic funding integration test flakiness
This commit fixes some flakiness exhibited in the current basic funding
workflow tests. This test can fail occasionally in resource constrained
environment due to a race condition which arises after Alice learns of
the channel, but Bob is still waiting for Alice’s notification. As a
temporary fix, we now only check Alice’s state for the existence of the
channel.
2016-09-06 12:04:18 -07:00
Olaoluwa Osuntokun
83bf0be2cc
test: introduce a few networkHarness helper methods
This commit adds some new networkHarness helper methods which are
mean’t to reduce the verbosity of the previous basic tests, and also to
enable developers to right tests mote easily five a higher level
interface.
2016-08-31 11:59:25 -07:00
Olaoluwa Osuntokun
0511273b47
test: rename networkharness.go to networktest.go 2016-08-31 11:57:22 -07:00