lnd.xprv/contractcourt
Olaoluwa Osuntokun aaa8fa33b1
contractcourt: when creating resolveContract closure don't bind to loop variable
In this commit, we fix a long standing bug where at times a co-op
channel closure wouldn't be properly marked as fully closed in the
database. The culprit was a re-occurring code flaw we've seen many times
in the codebase: a closure variable that closes over a loop iterator
variable. Before this instance, I assumed that this could only pop up
when goroutines bind to the loop iterator within a  closure. However,
this instance is the exact same issue, but within a regular closure that
has _delayed_ execution. As the closure doesn't execute until long after
the loop has finished executing, it may still be holding onto the _last_
item the loop iterator variable was assigned to.

The fix for this issue is very simple: re-assign the channel point
before creating the closure. Without this fix, we would go to call
db.MarkChanFullyClosed on a channel that may not have yet actually be in
the pending close state, causing all executions to fail.

Fixes #1054.
Fixes #1056.
Fixes #1075.
2018-04-12 18:54:33 -07:00
..
briefcase_test.go build+multi: switch from bolt to bbolt 2018-03-10 19:01:13 -08:00
briefcase.go build+multi: switch from bolt to bbolt 2018-03-10 19:01:13 -08:00
chain_arbitrator_test.go contractcourt: add new ChainArbitrator struct as central coordinator of package 2018-01-22 19:19:36 -08:00
chain_arbitrator.go contractcourt: when creating resolveContract closure don't bind to loop variable 2018-04-12 18:54:33 -07:00
chain_watcher.go contractcourt: when creating resolveContract closure don't bind to loop variable 2018-04-12 18:54:33 -07:00
channel_arbitrator_test.go contractcourt: add new ChannelArbitrator struct 2018-01-22 19:19:34 -08:00
channel_arbitrator.go lnwallet/channel: add NewLocalForceCloseSummary 2018-04-06 09:46:30 +02:00
contract_resolvers_test.go contractcourt: add complete ContractResolver implementations 2018-01-22 19:19:36 -08:00
contract_resolvers.go multi: provide mempool=true to RegisterSpendNtfn 2018-04-03 11:24:07 +02:00
log.go contractcourt: create new package, add logger 2018-01-22 19:19:34 -08:00