Commit Graph

172 Commits

Author SHA1 Message Date
AdamISZ
567306b010
Add a maxconfirms argument to ListUnspentWitness
This change was inspired by #1984 - the underlying call to
ListUnspent supports a (min, max) range so it makes sense that
the WalletController interface can also support this; a
default no-maximum can be expressed using a MaxInt32 value.
2018-10-28 15:55:18 +01:00
Wilmer Paulino
ae3e66dccc
fundingmanager+lnwallet: allow specifying number of min confs for coin selection 2018-08-16 20:19:30 -07:00
Wilmer Paulino
d76f97d497
fundingmanager+lnwallet: make InitChannelReservation take in req rather than many args 2018-08-16 20:19:25 -07:00
Wilmer Paulino
51fc193ddc
lnwallet/wallet: export InitFundingReserveMsg and required fields 2018-08-16 20:19:24 -07:00
Olaoluwa Osuntokun
d2612e51bd
Merge pull request #1644 from wpaulino/kw-fees
multi: switch to sat/kw fees
2018-08-09 20:19:28 -07:00
Olaoluwa Osuntokun
d64bb5921e
Merge pull request #1635 from halseth/funding-broadcast-fail
Move funding tx broadcasting to Fundingmanager
2018-08-09 20:04:30 -07:00
Wilmer Paulino
a63677a381
multi: switch to transaction weight to calculate transaction fees
Due to a recent change within the codebase to return estimated fee rates
in sat/kw, this commit ensures that we use this fee rate properly by
calculing a transaction's fees using its weight. This includes all of
the different transactions that are created within lnd (funding, sweeps,
etc.). On-chain transactions still rely on a sat/vbyte fee rate since it's
required by btcwallet.
2018-08-09 17:29:50 -07:00
Olaoluwa Osuntokun
21451bf251
lnwallet: update dual funder verification code to use pkscript in GetUtxo 2018-07-31 21:28:56 -07:00
Johan T. Halseth
2a77b57788
lnwallet + funding: move funding tx publish to fundingmgr
This commit moves the responsibility for publishing the funding tx to
the network from the wallet to the funding manager. This is done to
distinguish the failure of completing the reservation within the wallet
and failure of publishing the transaction.

Earlier we could fail to broadcast the transaction, which would cause us
to fail the funding flow. This is not something we can do directly,
since the CompeteReservation call will mark the channel IsPending in the
databas.e
2018-07-31 14:53:21 +02:00
Olaoluwa Osuntokun
6f60f139f4 multi: switch over import paths from roasbeef/* to btcsuite/* 2018-07-13 17:05:39 -07:00
Conner Fromknecht
a66c488546
lnwallet/wallet: use public witness script hash helper 2018-07-03 17:07:48 -07:00
maurycy
3be08e69cf multi: 64bit aligment of atomic vars on arm/x86-32 2018-06-04 20:02:34 -07:00
Olaoluwa Osuntokun
95293f5102
lnwallet: add assertion in createCommitmentTx to detect overdraw attempts
In this commit, we add a precautionary assertion at the end of
createCommitmentTx. This assertion is meant to ensure that we don't
accept or propose a commitment transaction that attempts to send out
more than it was funded with.
2018-05-21 16:52:57 -07:00
Dimitris Tsapakidis
4009f7f874 multi: fix typos in comments 2018-04-17 19:03:27 -07:00
PaddyQuinn
5410725306 lnwallet: update comments 2018-03-12 19:37:18 -04:00
Conner Fromknecht
2e1dcd316c
lnwallet/wallet: store funding txn during reservation 2018-03-11 13:58:41 -07:00
Olaoluwa Osuntokun
116406c7ec
Merge pull request #769 from Roasbeef/new-lightning-key-derivation
multi: modify key derivation to be fully deterministic, remove p2pkh, wallet now witness only
2018-03-06 17:21:55 -05:00
Olaoluwa Osuntokun
5b063a0691
lnwallet: modify the way we derive revocation roots to be deterministic
In this commit, we modify the way we generate the secrets for
revocation roots to be fully deterministic. Rather than use a special
key and derive all sub-roots from that (mixing in some “salts”), we’ll
use the proper keychain.KeyFamily instead. This ensures that given a
static description of the channel, we’re able to re-derive our
revocation root properly.
2018-03-06 16:04:02 -05:00
Olaoluwa Osuntokun
a41f00e2d6
lnwallet: update funding flow to utilize keychain.KeyRing
In this commit, we modify the funding flow process to obtain all keys
necessary from the keychain.KeyRing interface. This ensure that all
keys we generate are fully deterministic.
2018-03-06 16:04:02 -05:00
Johan T. Halseth
0cbb759d0a
lnwallet: send ReservationError for invalid/incompatible reservation 2018-03-06 22:02:34 +01:00
Johan T. Halseth
e1bb762cf7
lnwallet: denominate in fee rate types 2018-02-26 22:42:25 +01:00
Johan T. Halseth
3fd7f28b39
lnwallet: don't ignore any returned error from PublishTransaction 2018-02-14 12:34:41 +01:00
Daniel McNally
8543497dcc multi: fixing it's/its typos in comments 2018-02-06 19:13:07 -08:00
practicalswift
a93736d21e multi: comprehensive typo fixes across all packages 2018-02-06 19:11:11 -08:00
MeshCollider
4b1cc98808 multi: apply roasbeef diff to support incoming socks.ProxiedAddr 2018-02-05 17:37:46 -08:00
Olaoluwa Osuntokun
cfacc18f72
Merge pull request #711 from Roasbeef/funding-fail-first
funding: during funding error fail before sending Error to peer
2018-02-05 15:09:21 -08:00
Olaoluwa Osuntokun
43fa9fe467
lnwallet: avoid creating dust change outputs in funding txns
Before this commit, if the remaining change was small enough, then it
was possible for us to generate a non-std funding transaction. This is
an issue as the txn would fail to propagate, meaning funds could
potentially be stuck in limbo if users didn't manually drop their
transaction history.

To avoid this scenario, we won't create a change output that is dusty.
Instead, we'll add these as miner fees.

Fixes #690.
2018-01-31 14:10:45 -08:00
Olaoluwa Osuntokun
246c05fcd8
lnwallet: add additional debug logging for txns during funding flows 2018-01-31 14:00:05 -08:00
Olaoluwa Osuntokun
30c4196f91
lnwallet: remove the closeObserver from the channel state machine
In this PR, we entirely remove the closeObserver from the channel state
machine. It was added very early on before most of the other aspects of
the daemon were built out. This goroutine was responsible for
dispatching notifications to outside parties if the commitment
transaction was spent at all. This had several issues, since it was
linked to the *lifetime* of the channel state machine itself. As a
result of this linkage, we had to do weird stuff like hand off in
memory pointers to the state machine in order to ensure notifications
were properly dispatched.
2018-01-22 19:19:47 -08:00
Olaoluwa Osuntokun
9777176d7d
lnwallet: don't use persistent pointer to funding tx within channel state machine
This commit fixes a lingering bug that could at times cause
incompatibilities with other implementations when attempting a
cooperative channel close. Before this commit, we would use a pointer
to the funding txin everywhere. As a result, each time we made a new
state, or verified one, we would modify the sequence field of the main
txin of the commitment transaction. Due to this if we updated the
channel, then went to do a cooperative channel closure, the sequence of
the txin would still be set to the value we used as the state hint.

To remedy this, we now copy the txin each time when making the
commitment transaction, and also the cooperative closure transaction.
This avoids accidentally mutating the txin itself.

Fixes #502.
2017-12-22 19:26:35 +01:00
Matt Drollette
adf0d98194 multi: fix several typos in godoc comments 2017-12-17 18:40:05 -08:00
Johan T. Halseth
fffe15f0fd lnwallet: add FundingFlag parameter to InitChannelReservation 2017-12-17 18:35:34 -08:00
Olaoluwa Osuntokun
bead1ba31d
lnwallet: properly check error when creating commit tx in funding flow 2017-12-14 14:55:03 -08:00
Olaoluwa Osuntokun
5e5cc9b209
lnwallet: add new method to register our preferred minHTLC value
Before this commit, during a reservation, we wouldn’t ever specify our
minHTL value. We don’t yet fully validate all channel constrains, but
doing this now serves to ensure that once those features are merged,
we’ll actually be setting a valid value for minHTLC.
2017-12-13 17:15:43 -08:00
Liu-Cheng Xu
2fb7f5d4f3 lnwallet: fix typos 2017-11-27 17:24:45 -06:00
Olaoluwa Osuntokun
24ad3e17de
lnwallet: reject funding flows if local amount is insufficient w.r.t fees 2017-11-26 14:08:56 -06:00
Olaoluwa Osuntokun
6d10677ef5
lnwallet: allow callers to specify fee for funding transaction in funding flow
In this commit, we modify the funding reservation workflow slightly to
allow callers to specify their own custom fee when initialization a
funding workflow. This gives power-users the ability to control exactly
how much in fees are paid for each new funding transaction.
2017-11-23 23:10:06 -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
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
8b0de51003
lnwallet: populate our HtlcBasePoint when reserving a funding reservation 2017-11-16 20:00:01 -08:00
Olaoluwa Osuntokun
7f667e2dbc
lnwallet: update funding flow to use new channeldb API's 2017-11-10 19:50:59 -08:00
Olaoluwa Osuntokun
145cd0b2b6
lnwallet: export HtlcWeight and CommitWeight publicly 2017-11-10 19:50:51 -08:00
Jim Posen
a13ad0a339 multi: Fix various typos. 2017-10-25 13:20:54 -07:00
Jim Posen
bd497438af lnwallet: Pass around key ring instead of individual keys.
The signatures of some functions/methods in lnwallet are simplified by
passing in a commitmentKeyRing argument instead of multiple keys.
2017-10-19 22:23:14 -07:00
Jim Posen
b29af869c7 lnwallet: Support funding tx fee estimation for more input types.
The fee estimation for funding transactions now properly accounts for
different types of UTXOs spent, whereas previously it assumed all
inputs were spending native P2WKH outputs.
2017-10-19 17:37:53 -07:00
Jim Posen
ced530f98e lnwallet: Use TxWeightEstimator for funding transaction. 2017-10-19 17:37:53 -07:00
Braydon Fuller
53181f3ec3 cmd/lncli+lnwallet: specify need for witness outputs for funding channels
In this commit, we extend the help message for `newaddress` 
to indicate which address types can be used when directly 
funding channels. Additionally, we add some additional text 
to the insufficient funding error to detail that we don't have 
enough witness outputs.
2017-09-29 15:38:26 -07:00
Olaoluwa Osuntokun
5bb3efba4c
lnwallet: properly use the lsat 6-bytes of the sha hash for state hints
This commit fixes an existing w.r.t the way that we constructed all
commitment transactions. We were computing the hash that the obfsucator
was derived form correctly, but we were using the first 6-bytes, rather
than the last 6 bytes.
2017-09-12 17:38:31 +02:00
Olaoluwa Osuntokun
73421caecc
lnwallet: don't attach the rpcclient to the lnwallet logging instance
We no longer attach the RPC client to the lnwallet logging instance as
it can generate a ton of spam in trace mode as it’ll dump the entire
hex encoded blocks, transactions, etc.
2017-08-30 20:32:37 -07:00
Olaoluwa Osuntokun
063525c6e0
channeldb: update the OutgoingPayment struct to use lnwire.MilliSatoshi 2017-08-22 00:52:12 -07:00