From 4449038ae550f9bb6c346deeb1bd2a60c467b39d Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Tue, 20 Feb 2018 20:48:53 -0800 Subject: [PATCH] lnwallet/btcwallet/btcwallet: adds extra double spend case Adds an extra case to the select statement to catch an error produced by btcd. The error is meant to signal that an output was previously spent, which can appear under certain race conditions in spending/broadcasting. This caused our final itest to fail because it would not try to recraft the justice txn. --- lnwallet/btcwallet/btcwallet.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lnwallet/btcwallet/btcwallet.go b/lnwallet/btcwallet/btcwallet.go index 51a69edd..5ba512db 100644 --- a/lnwallet/btcwallet/btcwallet.go +++ b/lnwallet/btcwallet/btcwallet.go @@ -427,6 +427,10 @@ func (b *BtcWallet) PublishTransaction(tx *wire.MsgTx) error { // Output was already spent. return lnwallet.ErrDoubleSpend } + if strings.Contains(err.Error(), "already been spent") { + // Output was already spent. + return lnwallet.ErrDoubleSpend + } if strings.Contains(err.Error(), "orphan transaction") { // Transaction is spending either output that // is missing or already spent.