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:
1 parent
1eb906bcfb
commit
e170b43615
4 files changed
+54
-25
No files matched your search
+29
-1
@@ -152,9 +152,11 @@ func createInterceptorFunc(peer string, messages []expectedMessage,
|
||||
func TestChannelLinkSingleHopPayment(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
serverErr := make(chan error, 4)
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*3,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
serverErr,
|
||||
testStartingHeight,
|
||||
)
|
||||
if err := n.start(); err != nil {
|
||||
@@ -219,9 +221,11 @@ func TestChannelLinkSingleHopPayment(t *testing.T) {
|
||||
func TestChannelLinkBidirectionalOneHopPayments(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
serverErr := make(chan error, 4)
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*3,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
serverErr,
|
||||
testStartingHeight,
|
||||
)
|
||||
if err := n.start(); err != nil {
|
||||
@@ -341,9 +345,11 @@ func TestChannelLinkBidirectionalOneHopPayments(t *testing.T) {
|
||||
func TestChannelLinkMultiHopPayment(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
serverErr := make(chan error, 4)
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*3,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
serverErr,
|
||||
testStartingHeight,
|
||||
)
|
||||
if err := n.start(); err != nil {
|
||||
@@ -438,9 +444,11 @@ func TestChannelLinkMultiHopPayment(t *testing.T) {
|
||||
func TestExitNodeTimelockPayloadMismatch(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
serverErr := make(chan error, 4)
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
serverErr,
|
||||
testStartingHeight,
|
||||
)
|
||||
if err := n.start(); err != nil {
|
||||
@@ -484,9 +492,11 @@ func TestExitNodeTimelockPayloadMismatch(t *testing.T) {
|
||||
func TestExitNodeAmountPayloadMismatch(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
serverErr := make(chan error, 4)
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
serverErr,
|
||||
testStartingHeight,
|
||||
)
|
||||
if err := n.start(); err != nil {
|
||||
@@ -522,9 +532,11 @@ func TestExitNodeAmountPayloadMismatch(t *testing.T) {
|
||||
func TestLinkForwardTimelockPolicyMismatch(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
serverErr := make(chan error, 4)
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
serverErr,
|
||||
testStartingHeight,
|
||||
)
|
||||
if err := n.start(); err != nil {
|
||||
@@ -572,9 +584,11 @@ func TestLinkForwardTimelockPolicyMismatch(t *testing.T) {
|
||||
func TestLinkForwardFeePolicyMismatch(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
serverErr := make(chan error, 4)
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
serverErr,
|
||||
testStartingHeight,
|
||||
)
|
||||
if err := n.start(); err != nil {
|
||||
@@ -623,9 +637,11 @@ func TestLinkForwardFeePolicyMismatch(t *testing.T) {
|
||||
func TestLinkForwardMinHTLCPolicyMismatch(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
serverErr := make(chan error, 4)
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
serverErr,
|
||||
testStartingHeight,
|
||||
)
|
||||
if err := n.start(); err != nil {
|
||||
@@ -675,9 +691,11 @@ func TestLinkForwardMinHTLCPolicyMismatch(t *testing.T) {
|
||||
func TestUpdateForwardingPolicy(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
serverErr := make(chan error, 4)
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
serverErr,
|
||||
testStartingHeight,
|
||||
)
|
||||
if err := n.start(); err != nil {
|
||||
@@ -768,9 +786,11 @@ func TestUpdateForwardingPolicy(t *testing.T) {
|
||||
func TestChannelLinkMultiHopInsufficientPayment(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
serverErr := make(chan error, 4)
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*3,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
serverErr,
|
||||
testStartingHeight,
|
||||
)
|
||||
if err := n.start(); err != nil {
|
||||
@@ -838,9 +858,11 @@ func TestChannelLinkMultiHopInsufficientPayment(t *testing.T) {
|
||||
func TestChannelLinkMultiHopUnknownPaymentHash(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
serverErr := make(chan error, 4)
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*3,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
serverErr,
|
||||
testStartingHeight,
|
||||
)
|
||||
if err := n.start(); err != nil {
|
||||
@@ -922,9 +944,11 @@ func TestChannelLinkMultiHopUnknownPaymentHash(t *testing.T) {
|
||||
func TestChannelLinkMultiHopUnknownNextHop(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
serverErr := make(chan error, 4)
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*3,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
serverErr,
|
||||
testStartingHeight,
|
||||
)
|
||||
if err := n.start(); err != nil {
|
||||
@@ -941,7 +965,7 @@ func TestChannelLinkMultiHopUnknownNextHop(t *testing.T) {
|
||||
htlcAmt, totalTimelock, hops := generateHops(amount, testStartingHeight,
|
||||
n.firstBobChannelLink, n.carolChannelLink)
|
||||
|
||||
davePub := newMockServer(t, "save").PubKey()
|
||||
davePub := newMockServer("save", serverErr).PubKey()
|
||||
invoice, err := n.makePayment(n.aliceServer, n.bobServer, davePub, hops,
|
||||
amount, htlcAmt, totalTimelock)
|
||||
if err == nil {
|
||||
@@ -987,9 +1011,11 @@ func TestChannelLinkMultiHopUnknownNextHop(t *testing.T) {
|
||||
func TestChannelLinkMultiHopDecodeError(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
serverErr := make(chan error, 4)
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*3,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
serverErr,
|
||||
testStartingHeight,
|
||||
)
|
||||
if err := n.start(); err != nil {
|
||||
@@ -1166,9 +1192,11 @@ func TestChannelLinkExpiryTooSoonMidNode(t *testing.T) {
|
||||
func TestChannelLinkSingleHopMessageOrdering(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
serverErr := make(chan error, 4)
|
||||
n := newThreeHopNetwork(t,
|
||||
btcutil.SatoshiPerBitcoin*3,
|
||||
btcutil.SatoshiPerBitcoin*5,
|
||||
serverErr,
|
||||
testStartingHeight,
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user