lnwallet: move teardown of rpctest before setup to ensure proper cleanup

* Previously, if the call to SetUp(..) returned an error, then the test
harness would fail to stop the running bcd process, and clean up the
test directories. This would cause any subsequent tests to fail. This
commit remedies this scenario.
This commit is contained in:
Olaoluwa Osuntokun 2016-02-05 12:32:23 -08:00
parent 27def9b623
commit 4632894562

@ -573,13 +573,13 @@ func TestLightningWallet(t *testing.T) {
// up this node with a chain length of 125, so we have plentyyy of BTC
// to play around with.
miningNode, err := rpctest.New(netParams, nil, nil)
defer miningNode.TearDown()
if err != nil {
t.Fatalf("unable to create mining node: %v", err)
}
if err := miningNode.SetUp(true, 25); err != nil {
t.Fatalf("unable to set up mining node: %v", err)
}
defer miningNode.TearDown()
// Funding via 5 outputs with 4BTC each.
testDir, lnwallet, err := createTestWallet(miningNode, netParams)