multi: move breach arbiter and utxo nursery into contractcourt package

In this commit, we take an initial step towards converting the existing
breach arbiter and utxo nursery logic into contract resolvers by moving
the files as is, into the `contractcourt` pacakge.

This commit is primarily move only, though we had to massage some
interfaces and config names along the way to make things compile and the
tests run properly.
This commit is contained in:
Olaoluwa Osuntokun committed 2021-09-27 19:10:31 -07:00
1 parent be2566cf26
commit 7bde1662e2
15 files changed
+388 -348

No files matched your search

+2 -2
View File
@@ -2519,7 +2519,7 @@ func (p *Brontide) handleLocalCloseReq(req *htlcswitch.ChanClose) {
// A type of CloseRegular indicates that the user has opted to close
// out this channel on-chain, so we execute the cooperative channel
// closure workflow.
case htlcswitch.CloseRegular:
case contractcourt.CloseRegular:
// First, we'll choose a delivery address that we'll use to send the
// funds to in the case of a successful negotiation.
@@ -2604,7 +2604,7 @@ func (p *Brontide) handleLocalCloseReq(req *htlcswitch.ChanClose) {
// A type of CloseBreach indicates that the counterparty has breached
// the channel therefore we need to clean up our local state.
case htlcswitch.CloseBreach:
case contractcourt.CloseBreach:
// TODO(roasbeef): no longer need with newer beach logic?
peerLog.Infof("ChannelPoint(%v) has been breached, wiping "+
"channel", req.ChanPoint)
+4 -3
View File
@@ -11,6 +11,7 @@ import (
"github.com/btcsuite/btcutil"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/contractcourt"
"github.com/lightningnetwork/lnd/htlcswitch"
"github.com/lightningnetwork/lnd/lntest/mock"
"github.com/lightningnetwork/lnd/lnwallet/chancloser"
@@ -165,7 +166,7 @@ func TestPeerChannelClosureAcceptFeeInitiator(t *testing.T) {
updateChan := make(chan interface{}, 1)
errChan := make(chan error, 1)
closeCommand := &htlcswitch.ChanClose{
CloseType: htlcswitch.CloseRegular,
CloseType: contractcourt.CloseRegular,
ChanPoint: bobChan.ChannelPoint(),
Updates: updateChan,
TargetFeePerKw: 12500,
@@ -491,7 +492,7 @@ func TestPeerChannelClosureFeeNegotiationsInitiator(t *testing.T) {
updateChan := make(chan interface{}, 1)
errChan := make(chan error, 1)
closeCommand := &htlcswitch.ChanClose{
CloseType: htlcswitch.CloseRegular,
CloseType: contractcourt.CloseRegular,
ChanPoint: bobChan.ChannelPoint(),
Updates: updateChan,
TargetFeePerKw: 12500,
@@ -835,7 +836,7 @@ func TestCustomShutdownScript(t *testing.T) {
updateChan := make(chan interface{}, 1)
errChan := make(chan error, 1)
closeCommand := htlcswitch.ChanClose{
CloseType: htlcswitch.CloseRegular,
CloseType: contractcourt.CloseRegular,
ChanPoint: chanPoint,
Updates: updateChan,
TargetFeePerKw: 12500,