mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-20 04:21:37 +02:00
multi: add labels to lnd native transactions
Follow up labelling of external transactions with labels for the transaction types we create within lnd. Since these labels will live a life of string matching, a version number and rigid format is added so that string matching is less painful. We start out with channel ID, where available, and a transaction "type". External labels, added in a previous PR, are not updated to this new versioned label because they are not lnd-initiated transactions. Label matching can check this case, then check for a version number.
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/htlcswitch"
|
||||
"github.com/lightningnetwork/lnd/labels"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
@@ -551,7 +552,14 @@ func (c *ChanCloser) ProcessCloseMsg(msg lnwire.Message) ([]lnwire.Message,
|
||||
return spew.Sdump(closeTx)
|
||||
}),
|
||||
)
|
||||
if err := c.cfg.BroadcastTx(closeTx, ""); err != nil {
|
||||
|
||||
// Create a close channel label.
|
||||
chanID := c.cfg.Channel.ShortChanID()
|
||||
closeLabel := labels.MakeLabel(
|
||||
labels.LabelTypeChannelClose, &chanID,
|
||||
)
|
||||
|
||||
if err := c.cfg.BroadcastTx(closeTx, closeLabel); err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user