server: instantiate utxon with NurseryConfig

This commit is contained in:
Conner Fromknecht 2017-10-01 20:39:40 -07:00
parent 82f4e7c038
commit 2b74a6549f
No known key found for this signature in database
GPG Key ID: 39DE78FBE6ACB0EF

@ -136,8 +136,6 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl,
invoices: newInvoiceRegistry(chanDB), invoices: newInvoiceRegistry(chanDB),
utxoNursery: newUtxoNursery(chanDB, cc.chainNotifier, cc.wallet),
identityPriv: privKey, identityPriv: privKey,
nodeSigner: newNodeSigner(privKey), nodeSigner: newNodeSigner(privKey),
@ -306,6 +304,26 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl,
return nil, err return nil, err
} }
utxnStore, err := newNurseryStore(&bitcoinGenesis, chanDB)
if err != nil {
srvrLog.Errorf("unable to create nursery store: %v", err)
return nil, err
}
s.utxoNursery = newUtxoNursery(&NurseryConfig{
ChainIO: cc.chainIO,
ConfDepth: 1,
DB: chanDB,
Estimator: cc.feeEstimator,
GenSweepScript: func() ([]byte, error) {
return newSweepPkScript(cc.wallet)
},
Notifier: cc.chainNotifier,
PublishTransaction: cc.wallet.PublishTransaction,
Signer: cc.wallet.Cfg.Signer,
Store: utxnStore,
})
// Construct a closure that wraps the htlcswitch's CloseLink method. // Construct a closure that wraps the htlcswitch's CloseLink method.
closeLink := func(chanPoint *wire.OutPoint, closeLink := func(chanPoint *wire.OutPoint,
closureType htlcswitch.ChannelCloseType) { closureType htlcswitch.ChannelCloseType) {
@ -315,17 +333,17 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl,
} }
s.breachArbiter = newBreachArbiter(&BreachConfig{ s.breachArbiter = newBreachArbiter(&BreachConfig{
Signer: cc.wallet.Cfg.Signer, ChainIO: s.cc.chainIO,
DB: chanDB, CloseLink: closeLink,
PublishTransaction: cc.wallet.PublishTransaction, DB: chanDB,
Notifier: cc.chainNotifier, Estimator: s.cc.feeEstimator,
ChainIO: s.cc.chainIO,
Estimator: s.cc.feeEstimator,
CloseLink: closeLink,
Store: newRetributionStore(chanDB),
GenSweepScript: func() ([]byte, error) { GenSweepScript: func() ([]byte, error) {
return newSweepPkScript(cc.wallet) return newSweepPkScript(cc.wallet)
}, },
Notifier: cc.chainNotifier,
PublishTransaction: cc.wallet.PublishTransaction,
Signer: cc.wallet.Cfg.Signer,
Store: newRetributionStore(chanDB),
}) })
// Create the connection manager which will be responsible for // Create the connection manager which will be responsible for