contractcourt/[incoming|outgoing]_contest_resolver: make inner resolver pointer
To make the linter happy, make a pointer to the inner resolver. Otherwise the linter would complain with copylocks: literal copies lock value since we'll add a mutex to the resolver in following commits.
This commit is contained in:
parent
4da2b290f9
commit
9b08ef6d4e
@ -271,13 +271,13 @@ func assertResolversEqual(t *testing.T, originalResolver ContractResolver,
|
||||
case *htlcOutgoingContestResolver:
|
||||
diskRes := diskResolver.(*htlcOutgoingContestResolver)
|
||||
assertTimeoutResEqual(
|
||||
&ogRes.htlcTimeoutResolver, &diskRes.htlcTimeoutResolver,
|
||||
ogRes.htlcTimeoutResolver, diskRes.htlcTimeoutResolver,
|
||||
)
|
||||
|
||||
case *htlcIncomingContestResolver:
|
||||
diskRes := diskResolver.(*htlcIncomingContestResolver)
|
||||
assertSuccessResEqual(
|
||||
&ogRes.htlcSuccessResolver, &diskRes.htlcSuccessResolver,
|
||||
ogRes.htlcSuccessResolver, diskRes.htlcSuccessResolver,
|
||||
)
|
||||
|
||||
if ogRes.htlcExpiry != diskRes.htlcExpiry {
|
||||
@ -375,13 +375,13 @@ func TestContractInsertionRetrieval(t *testing.T) {
|
||||
contestTimeout := timeoutResolver
|
||||
contestTimeout.htlcResolution.ClaimOutpoint = randOutPoint()
|
||||
resolvers = append(resolvers, &htlcOutgoingContestResolver{
|
||||
htlcTimeoutResolver: contestTimeout,
|
||||
htlcTimeoutResolver: &contestTimeout,
|
||||
})
|
||||
contestSuccess := successResolver
|
||||
contestSuccess.htlcResolution.ClaimOutpoint = randOutPoint()
|
||||
resolvers = append(resolvers, &htlcIncomingContestResolver{
|
||||
htlcExpiry: 100,
|
||||
htlcSuccessResolver: contestSuccess,
|
||||
htlcSuccessResolver: &contestSuccess,
|
||||
})
|
||||
|
||||
// For quick lookup during the test, we'll create this map which allow
|
||||
@ -521,7 +521,7 @@ func TestContractSwapping(t *testing.T) {
|
||||
|
||||
// We'll create two resolvers, a regular timeout resolver, and the
|
||||
// contest resolver that eventually turns into the timeout resolver.
|
||||
timeoutResolver := htlcTimeoutResolver{
|
||||
timeoutResolver := &htlcTimeoutResolver{
|
||||
htlcResolution: lnwallet.OutgoingHtlcResolution{
|
||||
Expiry: 99,
|
||||
SignedTimeoutTx: nil,
|
||||
@ -549,7 +549,7 @@ func TestContractSwapping(t *testing.T) {
|
||||
|
||||
// With the resolver inserted, we'll now attempt to atomically swap it
|
||||
// for its underlying timeout resolver.
|
||||
err = testLog.SwapContract(contestResolver, &timeoutResolver)
|
||||
err = testLog.SwapContract(contestResolver, timeoutResolver)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to swap contracts: %v", err)
|
||||
}
|
||||
@ -566,7 +566,7 @@ func TestContractSwapping(t *testing.T) {
|
||||
}
|
||||
|
||||
// That single contract should be the underlying timeout resolver.
|
||||
assertResolversEqual(t, &timeoutResolver, dbContracts[0])
|
||||
assertResolversEqual(t, timeoutResolver, dbContracts[0])
|
||||
}
|
||||
|
||||
// TestContractResolutionsStorage tests that we're able to properly store and
|
||||
|
@ -31,7 +31,7 @@ type htlcIncomingContestResolver struct {
|
||||
|
||||
// htlcSuccessResolver is the inner resolver that may be utilized if we
|
||||
// learn of the preimage.
|
||||
htlcSuccessResolver
|
||||
*htlcSuccessResolver
|
||||
}
|
||||
|
||||
// newIncomingContestResolver instantiates a new incoming htlc contest resolver.
|
||||
@ -45,7 +45,7 @@ func newIncomingContestResolver(
|
||||
|
||||
return &htlcIncomingContestResolver{
|
||||
htlcExpiry: htlc.RefundTimeout,
|
||||
htlcSuccessResolver: *success,
|
||||
htlcSuccessResolver: success,
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ func (h *htlcIncomingContestResolver) Resolve() (ContractResolver, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &h.htlcSuccessResolver, nil
|
||||
return h.htlcSuccessResolver, nil
|
||||
|
||||
// If the htlc was failed, mark the htlc as
|
||||
// resolved.
|
||||
@ -293,7 +293,7 @@ func (h *htlcIncomingContestResolver) Resolve() (ContractResolver, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &h.htlcSuccessResolver, nil
|
||||
return h.htlcSuccessResolver, nil
|
||||
}
|
||||
|
||||
witnessUpdates = preimageSubscription.WitnessUpdates
|
||||
@ -315,7 +315,7 @@ func (h *htlcIncomingContestResolver) Resolve() (ContractResolver, error) {
|
||||
// We've learned of the preimage and this information
|
||||
// has been added to our inner resolver. We return it so
|
||||
// it can continue contract resolution.
|
||||
return &h.htlcSuccessResolver, nil
|
||||
return h.htlcSuccessResolver, nil
|
||||
|
||||
case hodlItem := <-hodlChan:
|
||||
htlcResolution := hodlItem.(invoices.HtlcResolution)
|
||||
@ -420,7 +420,7 @@ func newIncomingContestResolverFromReader(r io.Reader, resCfg ResolverConfig) (
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
h.htlcSuccessResolver = *successResolver
|
||||
h.htlcSuccessResolver = successResolver
|
||||
|
||||
return h, nil
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ func newIncomingResolverTestContext(t *testing.T, isExit bool) *incomingResolver
|
||||
},
|
||||
}
|
||||
resolver := &htlcIncomingContestResolver{
|
||||
htlcSuccessResolver: htlcSuccessResolver{
|
||||
htlcSuccessResolver: &htlcSuccessResolver{
|
||||
contractResolverKit: *newContractResolverKit(cfg),
|
||||
htlcResolution: lnwallet.IncomingHtlcResolution{},
|
||||
htlc: channeldb.HTLC{
|
||||
|
@ -17,7 +17,7 @@ import (
|
||||
type htlcOutgoingContestResolver struct {
|
||||
// htlcTimeoutResolver is the inner solver that this resolver may turn
|
||||
// into. This only happens if the HTLC expires on-chain.
|
||||
htlcTimeoutResolver
|
||||
*htlcTimeoutResolver
|
||||
}
|
||||
|
||||
// newOutgoingContestResolver instantiates a new outgoing contested htlc
|
||||
@ -31,7 +31,7 @@ func newOutgoingContestResolver(res lnwallet.OutgoingHtlcResolution,
|
||||
)
|
||||
|
||||
return &htlcOutgoingContestResolver{
|
||||
htlcTimeoutResolver: *timeout,
|
||||
htlcTimeoutResolver: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ func (h *htlcOutgoingContestResolver) Resolve() (ContractResolver, error) {
|
||||
"into timeout resolver", h,
|
||||
h.htlcResolution.ClaimOutpoint,
|
||||
newHeight, h.htlcResolution.Expiry)
|
||||
return &h.htlcTimeoutResolver, nil
|
||||
return h.htlcTimeoutResolver, nil
|
||||
}
|
||||
|
||||
// The output has been spent! This means the preimage has been
|
||||
@ -209,7 +209,7 @@ func newOutgoingContestResolverFromReader(r io.Reader, resCfg ResolverConfig) (
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
h.htlcTimeoutResolver = *timeoutResolver
|
||||
h.htlcTimeoutResolver = timeoutResolver
|
||||
return h, nil
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ func newOutgoingResolverTestContext(t *testing.T) *outgoingResolverTestContext {
|
||||
}
|
||||
|
||||
resolver := &htlcOutgoingContestResolver{
|
||||
htlcTimeoutResolver: htlcTimeoutResolver{
|
||||
htlcTimeoutResolver: &htlcTimeoutResolver{
|
||||
contractResolverKit: *newContractResolverKit(cfg),
|
||||
htlcResolution: outgoingRes,
|
||||
htlc: channeldb.HTLC{
|
||||
|
Loading…
Reference in New Issue
Block a user