From 2b74a6549f419d73689be8e82b20ba43a7aac81e Mon Sep 17 00:00:00 2001
From: Conner Fromknecht <conner@mit.edu>
Date: Sun, 1 Oct 2017 20:39:40 -0700
Subject: [PATCH] server: instantiate utxon with NurseryConfig

---
 server.go | 38 ++++++++++++++++++++++++++++----------
 1 file changed, 28 insertions(+), 10 deletions(-)

diff --git a/server.go b/server.go
index 403a3e70..4df5f2bb 100644
--- a/server.go
+++ b/server.go
@@ -136,8 +136,6 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl,
 
 		invoices: newInvoiceRegistry(chanDB),
 
-		utxoNursery: newUtxoNursery(chanDB, cc.chainNotifier, cc.wallet),
-
 		identityPriv: privKey,
 		nodeSigner:   newNodeSigner(privKey),
 
@@ -306,6 +304,26 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl,
 		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.
 	closeLink := func(chanPoint *wire.OutPoint,
 		closureType htlcswitch.ChannelCloseType) {
@@ -315,17 +333,17 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl,
 	}
 
 	s.breachArbiter = newBreachArbiter(&BreachConfig{
-		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),
+		ChainIO:   s.cc.chainIO,
+		CloseLink: closeLink,
+		DB:        chanDB,
+		Estimator: s.cc.feeEstimator,
 		GenSweepScript: func() ([]byte, error) {
 			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