diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 89738200..939f3ce8 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -712,9 +712,9 @@ func (lc *LightningChannel) SignNextCommitment() ([]byte, uint32, error) { return nil, 0, err } - log.Tracef("ChannelPoint(%v): extending remote chain to height %v", + walletLog.Tracef("ChannelPoint(%v): extending remote chain to height %v", lc.channelState.ChanID, newCommitView.height) - log.Tracef("ChannelPoint(%v): remote chain: our_balance=%v, "+ + walletLog.Tracef("ChannelPoint(%v): remote chain: our_balance=%v, "+ "their_balance=%v, commit_tx: %v", lc.channelState.ChanID, newCommitView.ourBalance, newCommitView.theirBalance, newLogClosure(func() string { @@ -782,9 +782,9 @@ func (lc *LightningChannel) ReceiveNewCommitment(rawSig []byte, return err } - log.Tracef("ChannelPoint(%v): extending local chain to height %v", + walletLog.Tracef("ChannelPoint(%v): extending local chain to height %v", lc.channelState.ChanID, localCommitmentView.height) - log.Tracef("ChannelPoint(%v): local chain: our_balance=%v, "+ + walletLog.Tracef("ChannelPoint(%v): local chain: our_balance=%v, "+ "their_balance=%v, commit_tx: %v", lc.channelState.ChanID, localCommitmentView.ourBalance, localCommitmentView.theirBalance, newLogClosure(func() string { @@ -861,7 +861,7 @@ func (lc *LightningChannel) RevokeCurrentCommitment() (*lnwire.CommitRevocation, revocationEdge[:]) revocationMsg.NextRevocationHash = fastsha256.Sum256(revocationEdge[:]) - log.Tracef("ChannelPoint(%v): revoking height=%v, now at height=%v, window_edge=%v", + walletLog.Tracef("ChannelPoint(%v): revoking height=%v, now at height=%v, window_edge=%v", lc.channelState.ChanID, lc.localCommitChain.tail().height, lc.currentHeight+1, lc.revocationWindowEdge) @@ -878,7 +878,7 @@ func (lc *LightningChannel) RevokeCurrentCommitment() (*lnwire.CommitRevocation, lc.channelState.OurCommitSig = tail.sig lc.channelState.NumUpdates++ - log.Tracef("ChannelPoint(%v): state transition accepted: "+ + walletLog.Tracef("ChannelPoint(%v): state transition accepted: "+ "our_balance=%v, their_balance=%v", lc.channelState.ChanID, tail.ourBalance, tail.theirBalance) @@ -946,7 +946,7 @@ func (lc *LightningChannel) ReceiveRevocation(revMsg *lnwire.CommitRevocation) ( lc.usedRevocations = lc.usedRevocations[1:] lc.revocationWindow = append(lc.revocationWindow, revMsg) - log.Tracef("ChannelPoint(%v): remote party accepted state transition, "+ + walletLog.Tracef("ChannelPoint(%v): remote party accepted state transition, "+ "revoked height %v, now at %v", lc.channelState.ChanID, lc.remoteCommitChain.tail().height, lc.remoteCommitChain.tail().height+1) diff --git a/lnwallet/log.go b/lnwallet/log.go index 9de6f251..55a7671a 100644 --- a/lnwallet/log.go +++ b/lnwallet/log.go @@ -11,7 +11,7 @@ import ( // log is a logger that is initialized with no output filters. This // means the package will not perform any logging by default until the caller // requests it. -var log btclog.Logger +var walletLog btclog.Logger // The default amount of logging is none. func init() { @@ -21,14 +21,14 @@ func init() { // DisableLog disables all library log output. Logging output is disabled // by default until either UseLogger or SetLogWriter are called. func DisableLog() { - log = btclog.Disabled + walletLog = btclog.Disabled } // UseLogger uses a specified Logger to output package logging info. // This should be used in preference to SetLogWriter if the caller is also // using btclog. func UseLogger(logger btclog.Logger) { - log = logger + walletLog = logger btcwallet.UseLogger(logger) } diff --git a/lnwallet/wallet.go b/lnwallet/wallet.go index 69bddfb3..356d193b 100644 --- a/lnwallet/wallet.go +++ b/lnwallet/wallet.go @@ -333,7 +333,7 @@ func NewLightningWallet(config *Config, cdb *channeldb.DB) (*LightningWallet, er if err := cdb.PutIdKey(idPubkeyHash); err != nil { return nil, err } - log.Infof("stored identity key pubkey hash in channeldb") + walletLog.Infof("stored identity key pubkey hash in channeldb") } // Create a special websockets rpc client for btcd which will be used @@ -362,7 +362,6 @@ func NewLightningWallet(config *Config, cdb *channeldb.DB) (*LightningWallet, er return nil, err } - // TODO(roasbeef): logging return &LightningWallet{ ChainNotifier: chainNotifier, rpc: rpcc, @@ -1075,7 +1074,7 @@ func (l *LightningWallet) handleFundingCounterPartySigs(msg *addCounterPartySigs // * also record location of change address so can use AddCredit l.limboMtx.Unlock() - log.Infof("Broadcasting funding tx for ChannelPoint(%v): %v", + walletLog.Infof("Broadcasting funding tx for ChannelPoint(%v): %v", pendingReservation.partialState.FundingOutpoint, spew.Sdump(fundingTx)) @@ -1188,9 +1187,8 @@ func (l *LightningWallet) handleSingleFunderSigs(req *addSingleFunderSigsMsg) { // Script executes succesfully. ourCommitTx.TxIn[0].Witness = witness // TODO(roasbeef): replace engine with plain sighash check - vm, err := txscript.NewEngine(p2wsh, - ourCommitTx, 0, txscript.StandardVerifyFlags, nil, - nil, channelValue) + vm, err := txscript.NewEngine(p2wsh, ourCommitTx, 0, + txscript.StandardVerifyFlags, nil, nil, channelValue) if err != nil { req.err <- err return @@ -1270,7 +1268,7 @@ func (l *LightningWallet) openChannelAfterConfirmations(res *ChannelReservation) numConfs := uint32(res.numConfsToOpen) confNtfn, _ := l.ChainNotifier.RegisterConfirmationsNtfn(&txid, numConfs) - log.Infof("Waiting for funding tx (txid: %v) to reach %v confirmations", + walletLog.Infof("Waiting for funding tx (txid: %v) to reach %v confirmations", txid, numConfs) // Wait until the specified number of confirmations has been reached,