diff --git a/lnwallet/btcwallet/btcwallet.go b/lnwallet/btcwallet/btcwallet.go index f3b96d5e..a4569e52 100644 --- a/lnwallet/btcwallet/btcwallet.go +++ b/lnwallet/btcwallet/btcwallet.go @@ -461,6 +461,17 @@ func (b *BtcWallet) PublishTransaction(tx *wire.MsgTx, label string) error { return nil } +// LabelTransaction adds a label to a transaction. If the tx already +// has a label, this call will fail unless the overwrite parameter +// is set. Labels must not be empty, and they are limited to 500 chars. +// +// Note: it is part of the WalletController interface. +func (b *BtcWallet) LabelTransaction(hash chainhash.Hash, label string, + overwrite bool) error { + + return b.wallet.LabelTransaction(hash, label, overwrite) +} + // extractBalanceDelta extracts the net balance delta from the PoV of the // wallet given a TransactionSummary. func extractBalanceDelta( diff --git a/lnwallet/interface.go b/lnwallet/interface.go index 836f044d..bff571e1 100644 --- a/lnwallet/interface.go +++ b/lnwallet/interface.go @@ -231,6 +231,11 @@ type WalletController interface { // published transaction. PublishTransaction(tx *wire.MsgTx, label string) error + // LabelTransaction adds a label to a transaction. If the tx already + // has a label, this call will fail unless the overwrite parameter + // is set. Labels must not be empty, and they are limited to 500 chars. + LabelTransaction(hash chainhash.Hash, label string, overwrite bool) error + // SubscribeTransactions returns a TransactionSubscription client which // is capable of receiving async notifications as new transactions // related to the wallet are seen within the network, or found in diff --git a/mock.go b/mock.go index d6027614..6d40402b 100644 --- a/mock.go +++ b/mock.go @@ -326,6 +326,13 @@ func (m *mockWalletController) PublishTransaction(tx *wire.MsgTx, _ string) erro m.publishedTransactions <- tx return nil } + +func (m *mockWalletController) LabelTransaction(_ chainhash.Hash, _ string, + _ bool) error { + + return nil +} + func (*mockWalletController) SubscribeTransactions() (lnwallet.TransactionSubscription, error) { return nil, nil }