Commit Graph

2605 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
4a277276fd
lnwallet: update SendOutputs method on WalletController to accept fee
In this commit, we extend the existing SendOutputs method on the
WalletController interface to be able to accept a custom fee. With
this, users are now able to specify their exact fee, allowing the
wallet to be fee estimation agnostic.
2017-11-23 23:10:04 -06:00
Olaoluwa Osuntokun
a1c0e30051
lnwire: the FeeSatoshis field in the ClosingSigned message is now btcutil.Amount 2017-11-23 23:10:03 -06:00
Olaoluwa Osuntokun
78ccfb4989
lnwallet: add BtcdFeeEstimator implementation of FeeEstimator interface
In this commit, we add a new implementation of the FeeEstimator
interface: the BtcdFeeEstimator. This implementation of the
FeeEstimator is backed by an active bcd instance. Any requests to query
for the current fee for a given confirmation target are proxied to this
active bcd instance.
2017-11-23 23:10:02 -06:00
Olaoluwa Osuntokun
e20448ebc6
lnwallet: update StaticFeeEstimator to adhere to new FeeEstimator interface 2017-11-23 23:10:02 -06:00
Olaoluwa Osuntokun
b4855b687e
lnwallet: add Start() and Stop() method to the FeeEstimator interface 2017-11-23 23:10:01 -06:00
Olaoluwa Osuntokun
0713c8c7ce
lnwallet: extend FeeEstimator methods to be able to return an error
In this commit, we extend the FeeEstimator methods to allow them to
return an error. This is required as most implementations aside from
the static fee estimator will want to be able to return errors to users
to indicate the inability to properly estimate fees.
2017-11-23 23:10:01 -06:00
Olaoluwa Osuntokun
9b1f21e283
lnrpc: now able to set confirmation target or fee to relevant RPC's
In this commit, we modify the OpenChannel, CloseChannel, SendCoins, and
SendMany RPC’s to be able to allow users to manually specify their
fees. Users can either specify a target number of confirmations, or a
target value for manual sat/byte.
2017-11-23 23:09:56 -06:00
Olaoluwa Osuntokun
6ef2770e57 lnwallet: move FeeEstimator into distinct file
In this commit, we move the FeeEstimator interface into a distinct file
as follow up commits will begin to flesh out the interface with
additional implementations.
2017-11-23 22:58:54 -06:00
Olaoluwa Osuntokun
56c5959ee5
Merge pull request #434 from halseth/close-channel-active
Only consider channel active if added to switch
2017-11-22 01:34:55 -06:00
Johan T. Halseth
3a0d4e78ae
travis.yml: build btcd version from glide.yaml for use in integration tests 2017-11-20 14:22:15 -08:00
Johan T. Halseth
6065c763e6
rpcserver: only set channel Active=true if added to htlcswitch
For a calls to ListChannels we now only set the
ActiveChannel.Active=true if the link is found by the
htlcswitch. This is done to be able to make it possible
to tell if a newly opened channel has been added to
the htlcswitch, such that we can synchronize on this
during tests before we attempt to close the  channel.
2017-11-20 14:22:14 -08:00
Johan T. Halseth
ae7c6c7e8f
networktest: wait for channel to become active before attempting close 2017-11-20 14:21:57 -08:00
Olaoluwa Osuntokun
53f1743be0
lnwire: fix serialization order of global+local features in Init msg
Fixes #428.
2017-11-17 13:27:23 -08:00
andrew.shvv
4168c97a27 lnwallet: fix infinite loop in coin selection
Fix wrong calculation of overshot amount which causes coin select
function to go into infinite loop. If overshoot amount is calculated
by subtraction of totalSatoshis and amtNeeded than on the second
iteration of loop amtNeeded already include required fee inside, which
causes continuation of the coin selection loop.
2017-11-17 13:15:50 -08:00
Olaoluwa Osuntokun
b31e94573b
htlcswitch: properly set HtlcBasePoint in createTestChannel 2017-11-16 20:00:08 -08:00
Olaoluwa Osuntokun
e874922286
test: properly set new HtlcBasePoint in createTestPeer 2017-11-16 20:00:07 -08:00
Olaoluwa Osuntokun
6afebfba5d
htlcswitch: update link to match latest ChanSyncMsg API change 2017-11-16 20:00:06 -08:00
Olaoluwa Osuntokun
88d418c0ec
funding: add additional debug logging to during final funding flow stages 2017-11-16 20:00:06 -08:00
Olaoluwa Osuntokun
9f215723a6
lnwallet: verify new optional ChannelReestablish fields in ProcessChanSyncMsg
In this commit, we add fully verification (other than checking the
commitment point matches after the fact) of the new optional fields
added to the lnwire.ChannelReestablish message. Two scenarios can
arise: we realize the remote party is on a prior state (and possibly
lost data), or we realize that *we* are on a prior state with the
remote party verifiably proving that they’re on a newer state.
2017-11-16 20:00:05 -08:00
Olaoluwa Osuntokun
6cd210041d
lnwallet: assert that no chan sync is needed before updates in TestChanSyncFullySynced 2017-11-16 20:00:05 -08:00
Olaoluwa Osuntokun
94ffb07b90
lnwallet: ensure created channels are stopped in ChanSync tests 2017-11-16 20:00:04 -08:00
Olaoluwa Osuntokun
a655396616
lnwallet: add optional data loss support to ChanSyncMsg()
In this commit we extend the set of fields populated within the
returned lnwire.ChannelReestablish to populate the optional data loss
fields. This entails included the commitment secret of the most
recently revoked remote commitment transaction and also our current
unrevoked commitment point.
2017-11-16 20:00:04 -08:00
Olaoluwa Osuntokun
f7964e7474
lnwire: add observance of optional data loss fields to ChannelReestablish
In this commit, we add support within lnwire for the optional dataloss
fields in ChannelReestablish. With these fields, it’s possible to:
verify that the remote node really knows of the state of our prior
local commitment, and also that they’ve sent us the current commitment
point for their current state.

In the event of dataloss, it’s possible for the party which lost data
to claim their commitment output in the remote party’s commitment if
they broadcast their current commitment transaction.
2017-11-16 20:00:03 -08:00
Olaoluwa Osuntokun
d7cdf822e3
lnwallet: update commitmentKeyRing to account for distinct HTLC keys
In this commit, we update all the key derivation within the state
machine to account for the recent spec change which introduces a
distinct key for usages within all HTLC scripts. This change means that
the commitment payment and delay base points, are only required to be
online in the case that a party is forced to go to chain.

We introduce an additional local tweak to the keyring for the HTLC
tweak. Additionally, two new keys have been added: a local and a remote
HTLC key. Generation of sender/receiver HTLC scripts now use the local
and remote HTLC keys rather than the “payment” key for each party.
Finally, when creating/verifying signatures for second-level HTLC
transactions, we use these the distinct HTLC keys, rather than re-using
the payment keys.
2017-11-16 20:00:03 -08:00
Olaoluwa Osuntokun
a812974808
lnwallet: update sender/receiver HTLC scripts to use distinct HTLC keys
In this commit, we modify the naming and comments of the routines that
create the sender/receiver HTLC scripts to denote that a set of
distinct keys are used. The scripts materially haven’t changed, but the
set of keys expected has.
2017-11-16 20:00:02 -08:00
Olaoluwa Osuntokun
4700c1be04
funding: populate the HtlcPoint during the funding workflow 2017-11-16 20:00:02 -08:00
Olaoluwa Osuntokun
8b0de51003
lnwallet: populate our HtlcBasePoint when reserving a funding reservation 2017-11-16 20:00:01 -08:00
Olaoluwa Osuntokun
12e5951434
channeldb: extend ChannelConfig with new HtlcBasePoint key 2017-11-16 20:00:01 -08:00
Olaoluwa Osuntokun
a14a15641b lnwire: add new HtlcPoint to OpenChannel and AcceptChannel
In this commit, we begin implementing the latest spec change to reduce
the attack surface on online channels. In this commit, we introduce a
distinct HTLC base point which will be used to sign the second-level
HTLC transactions for each active HLTC on the commitment transaction of
the remote node. With this, we allow the commitment key to remain
offline, as it isn’t needed in routine channel updates, unless we need
to go to chain.
2017-11-16 19:59:50 -08:00
Olaoluwa Osuntokun
caec23a236
Merge pull request #384 from cfromknecht/utxn-incubate-2nd-layer-htlcs
Utxo Nursery, adds outgoing 2nd-layer HTLC persistence
2017-11-16 19:00:40 -08:00
Conner Fromknecht
5a2769664a
rpcserver: populate pending channel resp with htlcs 2017-11-16 16:16:05 -08:00
Conner Fromknecht
eee4c225bf
rpcserver: check for errors returned from incubation 2017-11-16 16:16:04 -08:00
Conner Fromknecht
2b74a6549f
server: instantiate utxon with NurseryConfig 2017-11-16 16:16:04 -08:00
Conner Fromknecht
82f4e7c038
nursery_store_test: adds basic tests for state changes 2017-11-16 16:16:04 -08:00
Conner Fromknecht
ed0c3dbc58
nursery_store: tracks last graduated and adds HeightsBelowOrEqual
This commit removes the use of a purge height from the nursery
 store, instead tracking the last graduated height. This serves
 to indicate the last height that the nursery store successfully
 graduated. It also adds a method for retrieving the set of all active
 heights below a particular threshold, e.g. the last graduated height,
 allowing the utxo nursery to replay these heights on startup for the
 specific purpose of re-registering for confirmations of outputs in the
 height index.
2017-11-16 16:16:04 -08:00
Conner Fromknecht
2ef821ed9a
lnd_test: extends force closure test to test for outgoing htlc incubation 2017-11-16 16:16:00 -08:00
Olaoluwa Osuntokun
d2c8f01768
routing/chainview: remove possibility of deadlock in shutdown of blockEventQueue 2017-11-16 16:01:21 -08:00
Jim Posen
0297042a8d chainntnfs: Use the new ConcurrentQueue in btcd notifier. 2017-11-16 15:15:22 -08:00
Jim Posen
c9ad9b2269 chainntnfs: Use the new ConcurrentQueue in neutrino notifier. 2017-11-16 15:15:22 -08:00
Jim Posen
726c8b2301 chainntnfs: Implement unbounded concurrent-safe FIFO queue.
This can be used in at least one place in the notifiers to improve
efficiency and reduce complexity.
2017-11-16 15:15:22 -08:00
Johan T. Halseth
555cead5ad peer: avoid blocked writeHandler<->queueHandler interaction
This commit addresses an issue that could occur if a
message was attempted added to the sendQueue by the
queueHandler before the writeHandler had started.

If a message was sent to the queueHandler before the
writeHandler was ready to accept messages on the
sendQueue, the message would be added to the
pendingMsg queue, but would not be attempted sent
on the sendQueue again before a new incoming message
triggered a new attempt.
2017-11-15 18:54:06 -08:00
Conner Fromknecht
2859956cd2
utxonursery_test: extends test vectors for nursery store 2017-11-15 18:49:13 -08:00
Conner Fromknecht
997a37ca23
utxonursery: integrate nursery store 2017-11-15 18:49:12 -08:00
Olaoluwa Osuntokun
1ca53ae906
test: decrease trickleDelay in integration tests to 50ms 2017-11-15 18:26:22 -08:00
Olaoluwa Osuntokun
2861f6e5f4
discovery: add additional comments to TestDeDuplicatedAnnouncements 2017-11-15 18:25:33 -08:00
Olaoluwa Osuntokun
d7aa769275
htlcswitch: add additional sleep to end of TestChannelLinkBidirectionalOneHopPayments 2017-11-15 18:25:01 -08:00
Olaoluwa Osuntokun
1be2a2a56a
rpc: display HTLC amount in satoshis in ListChannels response
Before this commit, they were displayed in mSAT which violates the
current trend of always displaying amounts externally in satoshis.
2017-11-15 18:23:58 -08:00
Olaoluwa Osuntokun
f189e2395a
routing: if the graph has never been pruned, prune with current height
In this commit we ensure that if this is the first time that the
ChannelRouter is starting, then we set the pruned height+hash to the
current best height. Otherwise, it’s possible that we attempt to update
the filter with a 0 prune height, which will restart a historical
rescan unnecessarily.
2017-11-15 18:19:39 -08:00
Olaoluwa Osuntokun
2b052cc889
routing: only update the filter if we have a non-zero chain view
In this commit we ensure that we only update the filter, if we have a
non-zero chain view. Otherwise, a mini rescan may be kicked off
unnecessarily  if we don’t yet know of any channels yet in the greater
graph.
2017-11-15 18:17:51 -08:00
Conner Fromknecht
35e3201097
lnwallet/script_utils: adds public HtlcSpendSuccess witness func 2017-11-15 18:08:33 -08:00