From a1a9834a534cb75df3b91f34a02006426b2cf397 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Mon, 15 Jan 2018 23:26:35 +0100 Subject: [PATCH] lnwallet: add PublishTransaction error types --- lnwallet/interface.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lnwallet/interface.go b/lnwallet/interface.go index c80d4479..87d1ea81 100644 --- a/lnwallet/interface.go +++ b/lnwallet/interface.go @@ -35,6 +35,11 @@ const ( 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 // original output. type Utxo struct { @@ -183,6 +188,11 @@ type WalletController interface { // PublishTransaction performs cursory validation (dust checks, etc), // 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 // SubscribeTransactions returns a TransactionSubscription client which