lnwire+lnd: Make Logging Messages Great Again

This commit modifies the login of sent/recv’d wire messages in trace
mode in order utilize the more detailed, and automatically generated
logging statements using pure spew.Sdump.

In order to avoid the spammy messages due to spew printing the
btcec.S256() curve paramter within wire messages with public keys, we
introduce a new logging function to unset the curve paramter to it
isn’t printed in its entirety. To insure we don’t run into any panics
as a result of a nil pointer defense, we now copy the public keys
during the funding process so we don’t run into a panic due to
modifying a pointer to the same object.
This commit is contained in:
Olaoluwa Osuntokun committed 2017-01-14 17:52:18 -08:00
1 parent 0bfdcde969
commit d884efea29
24 files changed
+60 -400

No files matched your search

+2 -18
View File
@@ -29,8 +29,8 @@ type CloseRequest struct {
RequesterCloseSig *btcec.Signature
// Fee is the required fee-per-KB the closing transaction must have.
// It is recommended that a "sufficient" fee be paid in order to achieve
// timely channel closure.
// It is recommended that a "sufficient" fee be paid in order to
// achieve timely channel closure.
// TODO(roasbeef): if initiator always pays fees, then no longer needed.
Fee btcutil.Amount
}
@@ -117,19 +117,3 @@ func (c *CloseRequest) Validate() error {
// We're good!
return nil
}
// String returns the string representation of the target CloseRequest.
//
// This is part of the lnwire.Message interface.
func (c *CloseRequest) String() string {
var serializedSig []byte
if c.RequesterCloseSig != nil && c.RequesterCloseSig.R != nil {
serializedSig = c.RequesterCloseSig.Serialize()
}
return fmt.Sprintf("\n--- Begin CloseRequest ---\n") +
fmt.Sprintf("ChannelPoint:\t\t%v\n", c.ChannelPoint) +
fmt.Sprintf("CloseSig\t\t%x\n", serializedSig) +
fmt.Sprintf("Fee:\t\t\t%d\n", c.Fee) +
fmt.Sprintf("--- End CloseRequest ---\n")
}