loopout/test: prevent modification of global test request

pull/248/head
Joost Jager 4 years ago
parent f5f2d4261b
commit 85eb3d0fee
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7

@ -225,12 +225,14 @@ func TestCustomSweepConfTarget(t *testing.T) {
// Use the highest sweep confirmation target before we attempt to use // Use the highest sweep confirmation target before we attempt to use
// the default. // the default.
testRequest.SweepConfTarget = testLoopOutOnChainCltvDelta - testReq := *testRequest
testReq.SweepConfTarget = testLoopOutOnChainCltvDelta -
DefaultSweepConfTargetDelta - 1 DefaultSweepConfTargetDelta - 1
// Set up custom fee estimates such that the lower confirmation target // Set up custom fee estimates such that the lower confirmation target
// yields a much higher fee rate. // yields a much higher fee rate.
ctx.Lnd.SetFeeEstimate(testRequest.SweepConfTarget, 250) ctx.Lnd.SetFeeEstimate(testReq.SweepConfTarget, 250)
ctx.Lnd.SetFeeEstimate(DefaultSweepConfTarget, 10000) ctx.Lnd.SetFeeEstimate(DefaultSweepConfTarget, 10000)
cfg := newSwapConfig( cfg := newSwapConfig(
@ -238,7 +240,7 @@ func TestCustomSweepConfTarget(t *testing.T) {
) )
initResult, err := newLoopOutSwap( initResult, err := newLoopOutSwap(
context.Background(), cfg, ctx.Lnd.Height, testRequest, context.Background(), cfg, ctx.Lnd.Height, &testReq,
) )
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
@ -357,7 +359,7 @@ func TestCustomSweepConfTarget(t *testing.T) {
// The sweep should have a fee that corresponds to the custom // The sweep should have a fee that corresponds to the custom
// confirmation target. // confirmation target.
_ = assertSweepTx(testRequest.SweepConfTarget) _ = assertSweepTx(testReq.SweepConfTarget)
// Once we have published an on chain sweep, we expect a preimage to // Once we have published an on chain sweep, we expect a preimage to
// have been pushed to our server. // have been pushed to our server.
@ -424,15 +426,16 @@ func TestPreimagePush(t *testing.T) {
// Start with a high confirmation delta which will have a very high fee // Start with a high confirmation delta which will have a very high fee
// attached to it. // attached to it.
testRequest.SweepConfTarget = testLoopOutOnChainCltvDelta - testReq := *testRequest
testReq.SweepConfTarget = testLoopOutOnChainCltvDelta -
DefaultSweepConfTargetDelta - 1 DefaultSweepConfTargetDelta - 1
// We set our mock fee estimate for our target sweep confs to be our // We set our mock fee estimate for our target sweep confs to be our
// max miner fee *2, so that our fee will definitely be above what we // max miner fee *2, so that our fee will definitely be above what we
// are willing to pay, and we will not sweep. // are willing to pay, and we will not sweep.
ctx.Lnd.SetFeeEstimate( ctx.Lnd.SetFeeEstimate(
testRequest.SweepConfTarget, chainfee.SatPerKWeight( testReq.SweepConfTarget, chainfee.SatPerKWeight(
testRequest.MaxMinerFee*2, testReq.MaxMinerFee*2,
), ),
) )
@ -446,7 +449,7 @@ func TestPreimagePush(t *testing.T) {
) )
initResult, err := newLoopOutSwap( initResult, err := newLoopOutSwap(
context.Background(), cfg, ctx.Lnd.Height, testRequest, context.Background(), cfg, ctx.Lnd.Height, &testReq,
) )
require.NoError(t, err) require.NoError(t, err)
swap := initResult.swap swap := initResult.swap

Loading…
Cancel
Save