Commit Graph

69 Commits

Author SHA1 Message Date
bryanvu
abe2e502d5 lnwallet: add FeeEstimator interface, StaticFeeEstimator implementation
This commit adds the FeeEstimator interface, which can be used for
future fee calculation implementations. Currently, there is only the
StaticFeeEstimator implementation, which returns the same fee rate for
any transaction.
2017-05-15 20:26:11 -07:00
Olaoluwa Osuntokun
459583ca04
breacharbiter: don't watch for channel closes if time locked balance is non-zero
This commit fixes a slight logic error in the breachArbiter. Previously
we wouldn’t watch a pending channel for closure if the regular
(settled) balance was non-zero. However, this was incorrect, as it’s
possible for us to be on the receiving side of a channel force closure.
This error would leave certain channels as “pending close zombies”
forever until a user manually deleted the entry (or promoted it to be
fully closed).

To fix this, we now utilize the new `TimeLockedBalance` field to make a
better judgment as to if the utxoNursery is watching over a channel or
not.
2017-05-14 19:07:14 -07:00
Olaoluwa Osuntokun
d47f004fbd
peer+rpcserver+breacharbiter: usel latest ChainNotifier API 2017-05-11 15:20:55 -07:00
Olaoluwa Osuntokun
2aa68a8517
breacharbiter: fix bug, properly populate ChannelCloseSummary 2017-05-04 17:40:52 -07:00
Olaoluwa Osuntokun
83a425b74c
breacharbiter: at startup, watch pending closed channels to mark as fully closed
This commit adds a start up check to the breachArbiter: it will now
watch all channels which are in the “pending closed” state, to ensure
that state of the database is up to date at all times. Once any of the
closing transactions for these channels have been confirmed, then they
will properly be marked as such within the database.
2017-05-04 17:40:27 -07:00
Olaoluwa Osuntokun
4609bd462f
breacharbiter: mark channel as fully closed after retribution enacted 2017-05-04 17:40:24 -07:00
Olaoluwa Osuntokun
27329ed9db
breacharbiter: mark channel as fully closed upon detection of unilateral close
This commit modifies the breachArbiter to properly mark a channel as
_fully_ closed once the transaction which force closed the channel has
been confirmed within the chain.
2017-05-04 17:40:14 -07:00
Olaoluwa Osuntokun
4f758eb549
breacharbiter: modify db API usage to match recent changes 2017-05-04 17:40:11 -07:00
bryanvu
7048480a4a minor: fixed arbiter spelling and comment/error messages in funding rpc messages 2017-02-24 11:37:33 -08:00
Olaoluwa Osuntokun
384fe61e73
multi: fix go vet warnings throughout code base 2017-02-16 19:33:19 +08:00
Olaoluwa Osuntokun
2c0d5e0f0d
breacharbiter: stop the stale contract when a live contract appears
This commit modifies the logic of the contract hand-off within the
breachArbiter to ensure that only a single internal closeObserver
goroutine is ever active for a given contract.

This modification cleans up the logs in the case of multiple
reconnections and may possible eliminate some non-deterministic bugs
related to channel force closures.
2017-02-02 17:28:15 -08:00
Trevin Hofmann
40c7bac3aa multi: fix a variety of typos throughout the repo 2017-01-17 17:02:56 -08:00
Olaoluwa Osuntokun
8990de4d99
breacharbiter: ensure failure to retrieve channels triggers start-up error
This commit moves the fetching of active channels from the
contractObserver goroutine up to the Start() method on the
breachArbiter. By doing this, we ensure that the user receives an error
(under the current set up) if the btcd node that lnd is connected to
doesn’t have their txindex enabled.
2017-01-14 18:03:51 -08:00
Olaoluwa Osuntokun
5affed38fc
multi: update btcsuite API's to latest upstream changes
This commit makes a large number of minor changes concerning API usage
within the deamon to match the latest version on the upstream btcsuite
libraries.

The major changes are the switch from wire.ShaHash to chainhash.Hash,
and that wire.NewMsgTx() now takes a paramter indicating the version of
the transaction to be created.
2017-01-05 13:56:34 -08:00
Olaoluwa Osuntokun
beb6303e2f
breacharbiter: only log if we have any active channels
This commit modifies the contractObserver slightly to along log if we
have any active channels, which avoids a meaningless log message.
2017-01-05 13:21:47 -08:00
Olaoluwa Osuntokun
276c384455
breacharbiter: fix double channel close panic bug
This commit fixes s bug in the breachArbiter which was introduced
during the change that added the live channel hand off from an active
peer. Rather than closing the settle channel of the _older_
breachObserver, the settle channel of the newer beachObserver was being
closed. This would result in a panic once the channel itself was
actually settled as the channel would be closed again.

To fix this bug, we now properly close the channel of the old settle
signal instead of the new one.
2016-12-30 16:30:11 -08:00
Olaoluwa Osuntokun
3e1c98f2f7
breacharbiter: accept handoff for live channel on peer connect
This commit modifies the interaction between the breachArbiter and the
peer struct such that the breachArbiter _always_ has the latest version
of a contract.

Prior to this commit once we connected out to a peer which we had an
active contract with and the breachArbiter was watching, we’d have two
copies of the channel in memory, instead of just a single one. This was
wasteful and caused some duplicated log messages due to two instances
of the channel being active.
2016-12-27 16:45:05 -08:00
Olaoluwa Osuntokun
71c6e837e3
breacharbiter: fix bug, don't exit main loop due to unknown contract 2016-11-28 20:08:06 -08:00
Olaoluwa Osuntokun
494fcec874
breacharbiter: introduce new sub-system to watch for breaches
This commit introduces a new sub-system into the daemon whose job it is
to vigilantly watch for any potential channel breaches throughout the
up-time of the daemon. The logic which was moved from the utxoNursery
in a prior commit now resides within the breachArbiter.

Upon start-up the breachArbiter will query the database for all active
channels, launching a goroutine for each channel in order to be able to
take action if a channel breach is detected. The breachArbiter is also
responsible for notifying the htlcSwitch about channel breaches in
order to black-list the breached linked during any multi-hop forwarding
decisions.
2016-11-28 19:44:09 -08:00