htlcswitch.test: add server error channel to concurrent access panic

This commit where added as a measure to avoid the panic during several
server simultanoius fault. The panic happened becuase *t.Testing
structure is not concurrent safe.
This commit is contained in:
Andrey Samokhvalov
2017-07-09 01:52:51 +03:00
committed by Olaoluwa Osuntokun
parent 1eb906bcfb
commit e170b43615
4 changed files with 54 additions and 25 deletions

View File

@@ -508,13 +508,14 @@ func (n *threeHopNetwork) stop() {
// channel link channel link channel link channel link
//
func newThreeHopNetwork(t *testing.T, aliceToBob,
bobToCarol btcutil.Amount, startingHeight uint32) *threeHopNetwork {
bobToCarol btcutil.Amount, serverErr chan error,
startingHeight uint32) *threeHopNetwork {
var err error
// Create three peers/servers.
aliceServer := newMockServer(t, "alice")
bobServer := newMockServer(t, "bob")
carolServer := newMockServer(t, "carol")
aliceServer := newMockServer("alice", serverErr)
bobServer := newMockServer("bob", serverErr)
carolServer := newMockServer("carol", serverErr)
// Create mock decoder instead of sphinx one in order to mock the
// route which htlc should follow.