lnwallet: add PublishTransaction error types

This commit is contained in:
Johan T. Halseth 2018-01-15 23:26:35 +01:00
parent 7abdd30a87
commit a1a9834a53
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26
1 changed files with 10 additions and 0 deletions

View File

@ -35,6 +35,11 @@ const (
PubKeyHash PubKeyHash
) )
// ErrDoubleSpend is returned from PublishTransaction in case the
// tx being published is spending an output spent by a conflicting
// transaction.
var ErrDoubleSpend = errors.New("Transaction rejected: output already spent")
// Utxo is an unspent output denoted by its outpoint, and output value of the // Utxo is an unspent output denoted by its outpoint, and output value of the
// original output. // original output.
type Utxo struct { type Utxo struct {
@ -183,6 +188,11 @@ type WalletController interface {
// PublishTransaction performs cursory validation (dust checks, etc), // PublishTransaction performs cursory validation (dust checks, etc),
// then finally broadcasts the passed transaction to the Bitcoin network. // then finally broadcasts the passed transaction to the Bitcoin network.
// If the transaction is rejected because it is conflicting with an
// already known transaction, ErrDoubleSpend is returned. If the
// transaction is already known (published already), no error will be
// returned. Other error returned depends on the currently active chain
// backend.
PublishTransaction(tx *wire.MsgTx) error PublishTransaction(tx *wire.MsgTx) error
// SubscribeTransactions returns a TransactionSubscription client which // SubscribeTransactions returns a TransactionSubscription client which