lightninglabs/pool

pool: daemon crashes if unable to reconcile local order state w/ a replaced pending batch

Roasbeef opened this issue · 0 comments

Reported by a Lightning Terminal user:

[ERR] LITD: Could not start subservers: unable to start account manager: unable to resume account X: unable to subscribe for account updates: checking pending batch failed: error removing pending batch artifacts: error abandoning channels from previous pending batch: error locating channel outpoint: no channel output found in batch tx for matched order Y

The start of the failed code path is here: https://github.com/lightninglabs/pool/blob/master/auctioneer/client.go#L579-L587

We go to abandon the channel shims we have have created:

pool/funding/manager.go

Lines 999 to 1005 in 3e49f4c

// Also abandon any channels that might still be pending
// from a previous round of the same batch or a previous
// batch that we didn't make it into the final round.
err = AbandonCanceledChannels(
matchedOrders, batchTx, m.cfg.WalletKit, m.cfg.BaseClient,
m.cfg.DB.GetOrder,
)

Ultimately failing here when it can't find an output its looking for in the batch execution transaction:

pool/funding/batch.go

Lines 95 to 105 in 3e49f4c

// For each ask order that was matched with this bid, we'll
// locate the channel outpoint then abandon it from lnd's
// channel database.
for _, matchedOrder := range matchedOrders {
_, idx, err := order.ChannelOutput(
batchTx, wallet, ourOrder, matchedOrder,
)
if err != nil {
return fmt.Errorf("error locating channel "+
"outpoint: %v", err)
}