Commit Graph

102 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
ab16933575 lnwallet: commit tx should have final sequence num 2016-02-05 20:24:32 -08:00
Olaoluwa Osuntokun
81a4887d11 lnwallet: move lockTimeToSequence to script_utils.go 2016-02-05 20:24:17 -08:00
Olaoluwa Osuntokun
fa05ee9a22 lnwallet: move pubKey comparison for funding output spend into spendMultiSig func
* This change makes the spendMultiSig function testable independent of
the reservation workflow.
2016-02-05 12:33:22 -08:00
Olaoluwa Osuntokun
4632894562 lnwallet: move teardown of rpctest before setup to ensure proper cleanup
* Previously, if the call to SetUp(..) returned an error, then the test
harness would fail to stop the running bcd process, and clean up the
test directories. This would cause any subsequent tests to fail. This
commit remedies this scenario.
2016-02-05 12:32:23 -08:00
Olaoluwa Osuntokun
1a8ae48807 lnwallet: point rpctest at my in-progress fork+branch
Fixes compilation issues for those not using my laptop :)
2016-02-03 12:05:53 -08:00
Olaoluwa Osuntokun
daeecd5fc0 lnwallet: nuke most of setup.go, no longer needed w/ wallet.Loader 2016-02-03 12:01:45 -08:00
Olaoluwa Osuntokun
b3cdc6167f lnwallet: switch over to using btcwallet's new Loader type
Allows us to remove a lot of duplicated code pertaining to wallet
setup. We also gain hooks into the wallet to trigger callbacks once the
wallet is created/opened.
2016-02-03 12:01:45 -08:00
Olaoluwa Osuntokun
92c14c99c3 lnwallet: update tests to utilize the in-progress btcsuite/btcd/rpctest package
Instead of creating “fake” utxos for bob, and alice. We now employ a
dedicated mining node to hand out utxos, and generate blocks with hand
picked transactions.
2016-02-03 12:01:44 -08:00
Olaoluwa Osuntokun
7bebefbd8f lnwallet: fix script bug, ensure sigScript is set before verification 2016-02-03 12:01:44 -08:00
Olaoluwa Osuntokun
74ee5334f4 lnwallet: allow configurable net param for wallet create/open 2016-02-03 12:01:44 -08:00
Olaoluwa Osuntokun
98bbd314a7 lnwallet: add active Bitcoin network to config 2016-02-03 12:01:44 -08:00
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