multi: fix linter warnings

This commit is contained in:
Olaoluwa Osuntokun 2018-01-19 17:41:08 -08:00
parent ca613a625f
commit 783f01e1c7
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21
6 changed files with 20 additions and 24 deletions

@ -112,7 +112,7 @@ const (
// so yet.
StateBroadcastCommit ArbitratorState = 1
// StateContractClose is a state that indicates the contract has
// StateContractClosed is a state that indicates the contract has
// already been "closed". At this point, we can now examine our active
// contracts, in order to create the proper resolver for each one.
StateContractClosed ArbitratorState = 2

@ -340,7 +340,7 @@ func (c *chainWatcher) closeObserver(spendNtfn *chainntnfs.SpendEvent) {
commitSpend, *remoteCommit,
); err != nil {
log.Errorf("unable to handle remote "+
"close for chan_point=%v",
"close for chan_point=%v: %v",
c.chanState.FundingOutpoint, err)
}
@ -618,7 +618,7 @@ func (c *chainWatcher) dispatchContractBreach(spendEvent *chainntnfs.SpendDetail
return c.chanState.CloseChannel(&closeSummary)
}
// CooperativeCloseContext is a transactional object that's used by external
// CooperativeCloseCtx is a transactional object that's used by external
// parties to initiate a cooperative closure negotiation. During the
// negotiation, we sign multiple versions of a closing transaction, either of
// which may be counter signed and broadcast by the remote party at any time.
@ -630,8 +630,12 @@ type CooperativeCloseCtx struct {
// watcher to ensure we detect all on-chain spends.
potentialCloses chan *channeldb.ChannelCloseSummary
// activeCloses keeps track of all the txid's that we're currently
// watching for.
activeCloses map[chainhash.Hash]struct{}
// watchCancel will be closed once *one* of the txid's in the map above
// is confirmed. This will cause all the lingering goroutines to exit.
watchCancel chan struct{}
watcher *chainWatcher

@ -679,20 +679,20 @@ const (
// needs to be taken for a given HTLC.
NoAction ChainAction = 0
// htlcTimeout indicates that the HTLC will timeout soon. As a result,
// we should get ready to sweep it on chain after the timeout.
// HtlcTimeoutAction indicates that the HTLC will timeout soon. As a
// result, we should get ready to sweep it on chain after the timeout.
HtlcTimeoutAction = 1
// HtlcClaim indicates that we should claim the HTLC on chain before
// its timeout period.
// HtlcClaimAction indicates that we should claim the HTLC on chain
// before its timeout period.
HtlcClaimAction = 2
// HtlcFailNow indicates that we should fail an outgoing HTLC
// HtlcFailNowAction indicates that we should fail an outgoing HTLC
// immediately by cancelling it backwards as it has no corresponding
// output in our commitment transaction.
HtlcFailNowAction = 3
// HtlcOutgoingWatchChain indicates that we can't yet timeout this
// HtlcOutgoingWatchAction indicates that we can't yet timeout this
// HTLC, but we had to go to chain on order to resolve an existing
// HTLC. In this case, we'll either: time it out once it expires, or
// will learn the pre-image if the remote party claims the output. In

@ -257,7 +257,7 @@ const (
AcceptedHtlcScriptSize = 3*1 + 20 + 5*1 + 33 + 7*1 + 20 + 4*1 +
33 + 5*1 + 4 + 5*1
// AcceptedHtlcTimeoutWitnessSize: 214
// AcceptedHtlcTimeoutWitnessSize 214
// - number_of_witness_elements: 1 byte
// - sender_sig: 73 bytes
// - nil_length: 1 byte
@ -333,7 +333,7 @@ const (
// - witness_script (offered_htlc_script)
OfferedHtlcTimeoutWitnessSize = 1 + 1 + 1 + 73 + 1 + 73 + 1 + 1 + OfferedHtlcScriptSize
// OfferedHtlcSuccessWitnessSize: 283 bytes
// OfferedHtlcSuccessWitnessSize 283 bytes
// - number_of_witness_elements: 1 byte
// - nil_length: 1 byte
// - receiver_sig: 73 bytes

@ -170,7 +170,11 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl,
quit: make(chan struct{}),
}
s.witnessBeacon = NewPreimageBeacon(s.invoices, chanDB.NewWitnessCache())
s.witnessBeacon = &preimageBeacon{
invoices: s.invoices,
wCache: chanDB.NewWitnessCache(),
subscribers: make(map[uint64]*preimageSubcriber),
}
// If the debug HTLC flag is on, then we invoice a "master debug"
// invoice which all outgoing payments will be sent and all incoming

@ -31,18 +31,6 @@ type preimageBeacon struct {
subscribers map[uint64]*preimageSubcriber
}
// NewPreimageBeacon creates a new preimageBeacon instance given an invoice
// registry and witness cache.
func NewPreimageBeacon(invoices *invoiceRegistry,
wCache *channeldb.WitnessCache) *preimageBeacon {
return &preimageBeacon{
invoices: invoices,
wCache: wCache,
subscribers: make(map[uint64]*preimageSubcriber),
}
}
// SubcribeUpdates returns a channel that will be sent upon *each* time a new
// preimage is discovered.
func (p *preimageBeacon) SubcribeUpdates() *contractcourt.WitnessSubcription {