Buffer a result channel.

This will allow the worker goroutine to return even if one of the
other workers has already errored, preventing these goroutines from
lingering forever blocking on a channel send.
This commit is contained in:
Josh Rickmar 2015-01-05 19:54:06 -05:00
parent 596a3154c1
commit 807379661c

View file

@ -665,7 +665,7 @@ func (s *Store) findPreviousCredits(tx *btcutil.Tx) ([]Credit, error) {
inputs := tx.MsgTx().TxIn
creditChans := make([]chan createdCredit, len(inputs))
for i, txIn := range inputs {
creditChans[i] = make(chan createdCredit)
creditChans[i] = make(chan createdCredit, 1)
go func(i int, op btcwire.OutPoint) {
key, ok := s.unspent[op]
if !ok {