lnwallet: add label transaction to WalletController interface

This commit is contained in:
carla 2020-05-25 08:38:05 +02:00
parent 7f1a450a7f
commit baeef63aab
No known key found for this signature in database
GPG Key ID: 4CA7FE54A6213C91
3 changed files with 23 additions and 0 deletions

View File

@ -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(

View File

@ -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

View File

@ -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
}