Commit Graph

91 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
80ce49a883 lnwallet: update btcwallet and chain.Client to new upstream API's
A major change for btcwallet adding a new RPC wallet, refactoring parts
of the wallet, and introducing new functionality has been introduced.
This commit updates lnwallet to the API changes. A future commit will
change lnwallet to use some of the new functionality such as the
notification server, etc.
2016-02-03 12:01:44 -08:00
Olaoluwa Osuntokun
034cbef66d lnwallet: avoid goroutines waiting for channel open indefinitely blocking
Select over the quit channel in order to shutdown goroutines waiting
for funding txn confirmations. Without this we may leak goroutines
which are blocked forever if the process isn’t exiting when the walet
is signaled to shutdown.
2016-02-03 12:01:44 -08:00
Olaoluwa Osuntokun
20d471a766 lnwalelt: add note for balance update ntfs 2016-02-03 12:01:44 -08:00
Olaoluwa Osuntokun
d96cf0ec64 lnwallet: fix receiver htlc script
* Fixes a bug in script_utils.go. CSV instead of CLTV was being used
  within the timeout clause of the receivers HTLC (sender can reclaim
the HTLC).
2016-02-03 12:01:44 -08:00
Olaoluwa Osuntokun
0ce4fb1294 lnwallet: properly set transaction version on commit txs 2016-02-03 12:01:44 -08:00
Tadge Dryja
2815afebb7 update imports to github 2016-01-16 10:45:54 -08:00
Olaoluwa Osuntokun
07b0d5ca3e lnwallet: once the reservation workflow is complete, wait then open the payment channel
* Hooks into the ChainNotifier infrastructure to receive a notification
once the funding transaction gets enough notifications.
* Still need to set up the notification grouting within a
LightningChannel to watch for uncooperative closures, and broadcasts
and revoked channel states.
2016-01-14 23:58:04 -08:00
Olaoluwa Osuntokun
6e0cfaf7ec lnwallet: re-introduce rpc calls during channel reservation workflow
* In preparation for regression testing once nodetest is finished.
* These sections we’re previously uncommented to allow for testing the
wallet without a full-node hooked up.
2016-01-14 23:58:04 -08:00
Olaoluwa Osuntokun
cf65aaa2c9 lnwallet: have wallet return db so it can be closed during shutdown
* Also remove some extra print statements from debugging
* Separate out logic to create wallet from creating an ID
2016-01-14 23:57:54 -08:00
Olaoluwa Osuntokun
f52b8370bc lnwallet: populate the update totem during channel initialization 2016-01-14 23:56:11 -08:00
Olaoluwa Osuntokun
27744a3582 lnwallet: add logic for adding/removing HTLCs
* Updates to the channel are made atomic, and consistent via a proxy
object: “ChannelUpdate” which encapsulates an update transaction. Only
one update transaction may be outstanding at any time.
* Update transactions are initiated via AddHTLC or SettleHTLC.
* Once a transaction has been begun, in order to complete the update
the transaction must first be presented with a signature from the
counter-party for our new version of the commitment tx
(VerifyNewCommitmentSigs), and finally to atomically commit the
transaction, the counterparty’s pre-image to their previous revocation
hash must be validate (Commit).
2016-01-14 23:56:10 -08:00
Olaoluwa Osuntokun
895d70e79f lnwallet: add funding tx p2sh output to lnchannel
* Allows for quick access to the pkScript when signing new commitment
transactions.
2016-01-14 23:56:10 -08:00
Olaoluwa Osuntokun
3fe82f475f lnwallet: correctly adjust cleared funds during AddHTLC
* When adding an HTLC, the update to settled balances are to the side
sending the HTLC.
2016-01-14 23:56:10 -08:00
Olaoluwa Osuntokun
7ec419bde5 lnwallet: add docstrings to script_utils.go 2016-01-14 23:56:10 -08:00
Olaoluwa Osuntokun
f257690788 lnwallet: finish docstrings within coin select code 2016-01-14 23:56:10 -08:00
Olaoluwa Osuntokun
b2cb33c3c2 lnwallet: add documentation to ChannelReservation
* Workflow along with expected call orders have been documented.
* With this, the initial iteration of ChannelReservation is mostly
complete.
* However, there are still some unfinished steps internally within the
wallet related to processing. Such as factoring proper tx fees,
splitting fees, some node interaction etc.
2016-01-14 23:56:10 -08:00
Tadge Dryja
19233dc42d wallet creation works, takes 11 seconds 2016-01-14 23:56:09 -08:00
Tadge Dryja
726ba629f5 ok now it works. Sortof. Still hangs, but hangs later, after writing pkh. 2016-01-14 23:56:09 -08:00
Olaoluwa Osuntokun
1772108544 lnwallet: start of HTLC update logic
* moved sorting of transaction outside of createCommitTx also us to add
HTLC’s before sorting
* On the fence about the proxy object design, will re-visit once we
start to implement the p2p code.
2016-01-14 23:56:09 -08:00
Olaoluwa Osuntokun
5a7b98a9e4 lnwallet: remove CLTV funding tx gen 2016-01-14 23:56:09 -08:00
Olaoluwa Osuntokun
41f4992218 lnwallet: add utils to generate HTLC scripts, split up commit output scripts 2016-01-14 23:56:08 -08:00
Olaoluwa Osuntokun
c41f7d1a7d lnwallet: update to 20 byte revocation hashes 2016-01-14 23:56:08 -08:00
Tadge Dryja
cb32ab1fb9 identify where it freezes. in btcwallet/walletdb/interface.go:271 2016-01-14 23:56:08 -08:00
Tadge Dryja
8504362c5e trying to store id pkh. Doesn't work; wallet creation never completes 2016-01-14 23:56:08 -08:00
Tadge Dryja
e70c6aa367 trying to store private identity key. Doesn't work. 2016-01-14 23:56:08 -08:00
Olaoluwa Osuntokun
a5f0d3e56e lnwallet: require TLS for rpc client 2015-12-29 21:52:20 -06:00
Olaoluwa Osuntokun
ace1aca43c lnwallet: actually connect the rpc client... 2015-12-29 21:08:56 -06:00
Olaoluwa Osuntokun
b3e821c4d2 lnwallet: make KeyGenMtx public, roc server needs to synchronize 2015-12-29 17:09:32 -06:00
Olaoluwa Osuntokun
e07e7cfec9 lnwallet: actually add the config file 2015-12-29 16:04:23 -06:00
Olaoluwa Osuntokun
7640e57cdc lnwallet: add dirty config 2015-12-29 15:59:57 -06:00
Olaoluwa Osuntokun
f1717b9620 lnwallet: embed btwallet within LightningWallet, exposes all methods publicly
* As a result in order to not over-shadow the Start/Stop methods of
btcwallet.Wallet, the Start/Stop methods on LightningWallet have been
renamed to Startup/Shutdown.
2015-12-29 12:45:31 -06:00
Olaoluwa Osuntokun
bc7bdcd22b lnwallet: remove draft wire structs from reservation.go, now lives in lnwire 2015-12-29 00:00:29 -06:00
Olaoluwa Osuntokun
1c4887e746 lnwallet: drop some comments upon script_utils.go 2015-12-29 00:00:29 -06:00
Olaoluwa Osuntokun
7648fee903 lnwallet: note to future roasbeef 2015-12-29 00:00:29 -06:00
Olaoluwa Osuntokun
ef7a2aa553 lnwallet: properly set sequence number in tx for CSV usage 2015-12-29 00:00:29 -06:00
Olaoluwa Osuntokun
774192ecc7 lnwallet: store their commit sig in channel reservation 2015-12-29 00:00:29 -06:00
Olaoluwa Osuntokun
1fd1d87e34 lnwallet/tests: include csv delay in channel reservation init, add doc strings 2015-12-29 00:00:29 -06:00
Olaoluwa Osuntokun
b95eb25595 lnwallet: generate a commitment transaction signature fo bob in wallet_test.go 2015-12-29 00:00:29 -06:00
Olaoluwa Osuntokun
9840585757 lnwallet: actually use 'amount' parameter 2015-12-29 00:00:29 -06:00
Olaoluwa Osuntokun
6eb77b02c2 lnwallet: add comments to wallet.go 2015-12-29 00:00:29 -06:00
Olaoluwa Osuntokun
8ca8eb60fb lnwallet: verify received commitment tx signature is valid 2015-12-29 00:00:29 -06:00
Olaoluwa Osuntokun
695a1e6c45 lnwallet: sign the REDEEMSCRIPT not the p2sh script :) 2015-12-29 00:00:28 -06:00
Olaoluwa Osuntokun
17f37cc254 lnwallet: shutdown rpc connection during stoppage 2015-12-29 00:00:28 -06:00
Olaoluwa Osuntokun
36e7c38812 lnwallet: introduce mutex around coin selection logic 2015-12-29 00:00:28 -06:00
Olaoluwa Osuntokun
7874357384 lnwallet: remove unused struct 2015-12-29 00:00:28 -06:00
Olaoluwa Osuntokun
4fdb2763e6 channeldb: create new channeldb package, update lnwallet to use new API
* Initial draft of brain dump of chandler. Nothing yet set in stone.
* Will most likely move the storage of all structs to a more “column”
oriented approach. Such that, small updates like incrementing the total
satoshi sent don’t result in the entire struct being serialized and
written.
* Some skeleton structs for other possible data we might want to store
are also included.
* Seem valuable to record as much data as possible for record keeping,
visualization, debugging, etc. Will need to set up a time+space+dirty
cache to ensure performance isn’t impacted too much.
2015-12-26 12:35:15 -06:00
Olaoluwa Osuntokun
d7a1c5d337 lnwallet: check for nil buckets during fetch in channeldb 2015-12-26 00:12:31 -06:00
Olaoluwa Osuntokun
3e2a753271 lnwallet: touch config smelly 2015-12-26 00:11:39 -06:00
Olaoluwa Osuntokun
0307f321ad lnwallet: switch LightningChannel struct to use channeldb instead of raw namespace 2015-12-26 00:08:04 -06:00
Olaoluwa Osuntokun
890ceecc1a lnwallet: csv delay is a uint32, fill forgotten fields in channel state 2015-12-26 00:07:30 -06:00