lnwallet: switch name of package logger to avoid module collision

This commit is contained in:
Olaoluwa Osuntokun 2016-07-27 11:28:52 -07:00
parent 13a95be7c0
commit 8a56fbf196
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2
3 changed files with 15 additions and 17 deletions

@ -712,9 +712,9 @@ func (lc *LightningChannel) SignNextCommitment() ([]byte, uint32, error) {
return nil, 0, err 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) 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, "their_balance=%v, commit_tx: %v", lc.channelState.ChanID,
newCommitView.ourBalance, newCommitView.theirBalance, newCommitView.ourBalance, newCommitView.theirBalance,
newLogClosure(func() string { newLogClosure(func() string {
@ -782,9 +782,9 @@ func (lc *LightningChannel) ReceiveNewCommitment(rawSig []byte,
return err 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) 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, "their_balance=%v, commit_tx: %v", lc.channelState.ChanID,
localCommitmentView.ourBalance, localCommitmentView.theirBalance, localCommitmentView.ourBalance, localCommitmentView.theirBalance,
newLogClosure(func() string { newLogClosure(func() string {
@ -861,7 +861,7 @@ func (lc *LightningChannel) RevokeCurrentCommitment() (*lnwire.CommitRevocation,
revocationEdge[:]) revocationEdge[:])
revocationMsg.NextRevocationHash = fastsha256.Sum256(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.channelState.ChanID, lc.localCommitChain.tail().height,
lc.currentHeight+1, lc.revocationWindowEdge) lc.currentHeight+1, lc.revocationWindowEdge)
@ -878,7 +878,7 @@ func (lc *LightningChannel) RevokeCurrentCommitment() (*lnwire.CommitRevocation,
lc.channelState.OurCommitSig = tail.sig lc.channelState.OurCommitSig = tail.sig
lc.channelState.NumUpdates++ 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, "our_balance=%v, their_balance=%v", lc.channelState.ChanID,
tail.ourBalance, tail.theirBalance) tail.ourBalance, tail.theirBalance)
@ -946,7 +946,7 @@ func (lc *LightningChannel) ReceiveRevocation(revMsg *lnwire.CommitRevocation) (
lc.usedRevocations = lc.usedRevocations[1:] lc.usedRevocations = lc.usedRevocations[1:]
lc.revocationWindow = append(lc.revocationWindow, revMsg) 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, "revoked height %v, now at %v", lc.channelState.ChanID,
lc.remoteCommitChain.tail().height, lc.remoteCommitChain.tail().height,
lc.remoteCommitChain.tail().height+1) lc.remoteCommitChain.tail().height+1)

@ -11,7 +11,7 @@ import (
// log is a logger that is initialized with no output filters. This // 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 // means the package will not perform any logging by default until the caller
// requests it. // requests it.
var log btclog.Logger var walletLog btclog.Logger
// The default amount of logging is none. // The default amount of logging is none.
func init() { func init() {
@ -21,14 +21,14 @@ func init() {
// DisableLog disables all library log output. Logging output is disabled // DisableLog disables all library log output. Logging output is disabled
// by default until either UseLogger or SetLogWriter are called. // by default until either UseLogger or SetLogWriter are called.
func DisableLog() { func DisableLog() {
log = btclog.Disabled walletLog = btclog.Disabled
} }
// UseLogger uses a specified Logger to output package logging info. // UseLogger uses a specified Logger to output package logging info.
// This should be used in preference to SetLogWriter if the caller is also // This should be used in preference to SetLogWriter if the caller is also
// using btclog. // using btclog.
func UseLogger(logger btclog.Logger) { func UseLogger(logger btclog.Logger) {
log = logger walletLog = logger
btcwallet.UseLogger(logger) btcwallet.UseLogger(logger)
} }

@ -333,7 +333,7 @@ func NewLightningWallet(config *Config, cdb *channeldb.DB) (*LightningWallet, er
if err := cdb.PutIdKey(idPubkeyHash); err != nil { if err := cdb.PutIdKey(idPubkeyHash); err != nil {
return nil, err 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 // 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 return nil, err
} }
// TODO(roasbeef): logging
return &LightningWallet{ return &LightningWallet{
ChainNotifier: chainNotifier, ChainNotifier: chainNotifier,
rpc: rpcc, rpc: rpcc,
@ -1075,7 +1074,7 @@ func (l *LightningWallet) handleFundingCounterPartySigs(msg *addCounterPartySigs
// * also record location of change address so can use AddCredit // * also record location of change address so can use AddCredit
l.limboMtx.Unlock() l.limboMtx.Unlock()
log.Infof("Broadcasting funding tx for ChannelPoint(%v): %v", walletLog.Infof("Broadcasting funding tx for ChannelPoint(%v): %v",
pendingReservation.partialState.FundingOutpoint, pendingReservation.partialState.FundingOutpoint,
spew.Sdump(fundingTx)) spew.Sdump(fundingTx))
@ -1188,9 +1187,8 @@ func (l *LightningWallet) handleSingleFunderSigs(req *addSingleFunderSigsMsg) {
// Script executes succesfully. // Script executes succesfully.
ourCommitTx.TxIn[0].Witness = witness ourCommitTx.TxIn[0].Witness = witness
// TODO(roasbeef): replace engine with plain sighash check // TODO(roasbeef): replace engine with plain sighash check
vm, err := txscript.NewEngine(p2wsh, vm, err := txscript.NewEngine(p2wsh, ourCommitTx, 0,
ourCommitTx, 0, txscript.StandardVerifyFlags, nil, txscript.StandardVerifyFlags, nil, nil, channelValue)
nil, channelValue)
if err != nil { if err != nil {
req.err <- err req.err <- err
return return
@ -1270,7 +1268,7 @@ func (l *LightningWallet) openChannelAfterConfirmations(res *ChannelReservation)
numConfs := uint32(res.numConfsToOpen) numConfs := uint32(res.numConfsToOpen)
confNtfn, _ := l.ChainNotifier.RegisterConfirmationsNtfn(&txid, numConfs) 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) txid, numConfs)
// Wait until the specified number of confirmations has been reached, // Wait until the specified number of confirmations has been reached,