Skip to content

Commit

Permalink
server: properly instantiate updated BreachConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
cfromknecht committed Sep 20, 2017
1 parent 6087c52 commit 5fad2d9
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions server.go
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/roasbeef/btcd/btcec"
"github.com/roasbeef/btcd/chaincfg/chainhash"
"github.com/roasbeef/btcd/connmgr"
"github.com/roasbeef/btcd/wire"
"github.com/roasbeef/btcutil"

"github.com/go-errors/errors"
Expand Down Expand Up @@ -288,16 +289,26 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl,
return nil, err
}

// Construct a closure that wraps the htlcswitch's CloseLink method.
closeLink := func(chanPoint *wire.OutPoint,
closureType htlcswitch.ChannelCloseType) {
// TODO(conner): Properly respect the update and error channels
// returned by CloseLink.
s.htlcSwitch.CloseLink(chanPoint, closureType)
}

s.breachArbiter = newBreachArbiter(&BreachConfig{
Signer: cc.wallet.Cfg.Signer,
DB: chanDB,
Wallet: cc.wallet,
Notifier: cc.chainNotifier,
ChainIO: s.cc.chainIO,
Estimator: s.cc.feeEstimator,
HtlcSwitch: s.htlcSwitch,
Store: newRetributionStore(chanDB),
GenSweepScript: newSweepPkScript,
Signer: cc.wallet.Cfg.Signer,
DB: chanDB,
PublishTransaction: cc.wallet.PublishTransaction,
Notifier: cc.chainNotifier,
ChainIO: s.cc.chainIO,
Estimator: s.cc.feeEstimator,
CloseLink: closeLink,
Store: newRetributionStore(chanDB),
GenSweepScript: func() ([]byte, error) {
return newSweepPkScript(cc.wallet)
},
})

// Create the connection manager which will be responsible for
Expand Down

0 comments on commit 5fad2d9

Please sign in to comment.