Commit Graph
100 Commits
Author SHA1 Message Date
Olaoluwa Osuntokun 8e5f028eea lnwallet: create channeldb.go add serialization methods for OpenChannel 2015-12-25 17:00:20 -06:00
Olaoluwa Osuntokun c2403d4b2d shachain: switch encode/decode methods to use io.Reader/Writer
* Help avoid a bug related to passing a copy of bytes.Buffer into
Encode/Decode instead of a pointer
2015-12-24 12:48:24 -06:00
Olaoluwa Osuntokun 5840786922 lnwallet: save redeemScript in channel state 2015-12-24 12:42:29 -06:00
Olaoluwa Osuntokun 15f15bb3af rename revocation package to shachain
* Constructors now also more in line with “Effective Go”
2015-12-24 12:42:03 -06:00
Olaoluwa Osuntokun 07646d05db move channel state struct to channeldb.go
* All fields are now publicly exported
2015-12-24 12:41:15 -06:00
Olaoluwa Osuntokun 868ac0aca0 revocation: switch to tadge's bit-shifting to figure out log2 instead of using math 2015-12-23 12:12:53 -06:00
Olaoluwa Osuntokun a4762b818f Merge branch 'master' of li.lan:labs/plasma 2015-12-22 22:39:28 -06:00
Olaoluwa Osuntokun 882e7640d5 lnwallet: update tests to switch to new workflow 2015-12-22 22:32:18 -06:00
Olaoluwa Osuntokun d24831dc29 lnwallet: update workflow around contributions 2015-12-22 22:31:17 -06:00
Olaoluwa Osuntokun e762d328fa lnwallet: add ChannelContribution, finalize ChannelReservation API/workflow
* Final workflow has been greatly simplified.
* Interaction is now:
   * init
   * add contribution
   * complete
2015-12-22 22:30:11 -06:00
Olaoluwa Osuntokun b606804934 lnwallet: add comments to fields of OpenChannelState 2015-12-22 22:27:33 -06:00
Olaoluwa Osuntokun 36ec5b4927 lnwallet: update tests to AddContribution API change 2015-12-21 15:55:17 -06:00
Olaoluwa Osuntokun 829f67f33e lnwallet: CompleteReservation now includes sig for commit tx 2015-12-21 15:54:33 -06:00
Olaoluwa Osuntokun 584fc9b620 lnwallet: AddFunds is now AddContribution, accounts for commitment tx
* Contribution from remote host necessary to construct the initial
commitment transaction is now also expected
* All message structs and handlers updated accordingly
* AddContribution now also generates both commitment tnxs, and
generates a signature for their version of the commitment transaction
2015-12-21 15:53:34 -06:00
Olaoluwa Osuntokun e7e546af9a lnwallet/reservation: fundingLockTime is int64 track their revoke hash 2015-12-21 15:49:57 -06:00
Olaoluwa Osuntokun d7d569b267 lnwallet: track their current commitment sig in channel state 2015-12-21 15:49:34 -06:00
Olaoluwa Osuntokun 06bad8ba42 revocation: fix integer underflow infinite loop bug in sha chain
* `i := toDerive - 1` created an unsigned integer, the last loop
iteration subtracted from zero causing this to underflow creating an
infinite loop
* Instead, initialized `i` as an int, and cast to uint as needed
2015-12-21 15:47:36 -06:00
Olaoluwa Osuntokun d7fba0e89d revocation: fix nil pointer panic in shachain constructor 2015-12-21 15:41:23 -06:00
Olaoluwa Osuntokun b9a6155021 lnwallet: add field to track current out-of-chain revocation hash 2015-12-20 21:48:56 -06:00
Olaoluwa Osuntokun 8cbbba14a4 lnwallet: assume symmetric initial channel balance 2015-12-20 21:48:45 -06:00
Olaoluwa Osuntokun 6d006ac79c lnwallet: sort inputs/outputs in commit tx 2015-12-20 21:47:57 -06:00
Olaoluwa Osuntokun d3fe04ab9b lnwallet: add function to locate script index to script_utils.go 2015-12-20 21:47:29 -06:00
Olaoluwa Osuntokun baf3b70e31 plasma: correct commit with sketch of lnwire.Message interface 2015-12-20 21:47:00 -06:00
Olaoluwa Osuntokun 422f0a9791 revocation: split up methods to get current pre-image and hash 2015-12-20 21:46:41 -06:00
Olaoluwa Osuntokun 34e35fe2d5 lnwallet: set commit tnx related info in ChannelReservation
* Future commit will ditch all the thread-safe “getter” like methods.
We’re all adults just make sure to grab the lock.
* All wallet mutation funcs will also document which fields are set
after completion of the request
* Set shaChain, delivery address, commitment key
2015-12-20 17:13:14 -06:00
Olaoluwa Osuntokun c7d604fd0b lnwallet: use funcs in script_utils.go 2015-12-20 17:11:21 -06:00
Olaoluwa Osuntokun 30523d7db3 lnwallet: import badge's script utils in new file 2015-12-20 17:10:24 -06:00
Olaoluwa Osuntokun f52f2fd26c plamas/peer: just use net.Conn for generality 2015-12-20 17:10:09 -06:00
Olaoluwa Osuntokun 093bbf40ad lnwallet: track some more stats in channel state 2015-12-20 15:17:13 -06:00
Olaoluwa Osuntokun d5f36d81c8 plasma: rough draft of peer struct 2015-12-20 15:16:38 -06:00
Olaoluwa Osuntokun d2e3b376ea lnwallet: re-name package to lnwallet, though it was? 2015-12-20 00:00:50 -06:00
Olaoluwa Osuntokun 61f5772c40 lnwallet: re-use same wallet instance across tests
* btcwallet still rather slow to create/open, due to scrypt derivation
2x?
2015-12-18 21:48:55 -06:00
Olaoluwa Osuntokun 29d381ad21 lnwallet: adapt tests to field changes 2015-12-18 21:47:47 -06:00
Olaoluwa Osuntokun 420e34cc91 lnwallet: forgot some field name changes 2015-12-18 21:43:37 -06:00
Olaoluwa Osuntokun a689595054 lnwallet: comment out lnwire-like serialization stuff for now 2015-12-18 21:42:49 -06:00
Olaoluwa Osuntokun 2f7a801dcb lnwallet: embed channel state within ChannelReservation 2015-12-18 21:39:51 -06:00
Olaoluwa Osuntokun 6bb37448f0 lnwallet: add num updates and delivery addresses to channel state
* move utility funds to bottom of file
2015-12-18 21:35:40 -06:00
Olaoluwa Osuntokun 6af4aaf71b lnwallet: separate channel state into new struct
* Will be integrated into ChannelReservation also
* This is the struct that will be persisted to disk
2015-12-18 15:37:13 -06:00
Olaoluwa Osuntokun feb00e04c4 lnwallet: add fun to create initial Commitment Tx
* Forgot we assume mal fix, need to go back and update the reservation
workflow
2015-12-16 22:58:49 -06:00
Olaoluwa Osuntokun 48c1c39dc9 lnwallet: add skeleton for LightningChannel
* pretty much same as strux/lchannel.go
* Too beefy atm, added note to bring back old CompleteReservation
struct
2015-12-16 22:58:01 -06:00
Olaoluwa Osuntokun a83dac4e86 revocation: skeleton for possibly needed method? 2015-12-16 22:56:11 -06:00
Olaoluwa Osuntokun ddb74258ff lnwallet: import tadge's p2shify func 2015-12-16 22:55:52 -06:00
Olaoluwa Osuntokun e2c4ccbe28 chaintfns: skeleton of first notifier 2015-12-16 22:55:22 -06:00
Olaoluwa Osuntokun d9f32db185 empty daemon entry point 2015-12-16 18:42:52 -06:00
Olaoluwa Osuntokun 139e63c9cf shachain: constructors for remote vs origin 2015-12-16 18:42:07 -06:00
Olaoluwa Osuntokun ce42741daa First stab at shachain. Untested. Still doin't really get it... 2015-12-16 18:36:03 -06:00
Olaoluwa Osuntokun 147748d178 rename wallet to lnwallet 2015-12-16 14:51:59 -06:00
Olaoluwa Osuntokun 9de294c31f add link to explanation 2015-12-16 14:49:01 -06:00
Olaoluwa Osuntokun f475f6a0f2 Merge branch 'master' of li.lan:labs/plasma 2015-12-16 14:46:42 -06:00
Olaoluwa Osuntokun 69936d694c revocation: HyperShaChan sounds cooler... 2015-12-16 14:43:59 -06:00
Olaoluwa Osuntokun 1621b8cc99 wallet/wallet_test: test for canceling reservations 2015-12-16 14:41:15 -06:00
Olaoluwa Osuntokun 24efbb46c3 wallet/reservation: Cancel needs to return an error 2015-12-16 14:40:44 -06:00
Olaoluwa Osuntokun 354bc74d3c Flesh out LightningChannel struct a bit more
* p2p logic will only know about this object
* Purposes include storing old commitment txns, receiving them,
triggering p2p actions base off of channelEvents, getting/verifying
revocation hashes, etc
2015-12-16 14:40:11 -06:00
Olaoluwa Osuntokun 07984836e4 Create skeleton for revocation methods
* Just rusty’s shachain for now
2015-12-16 14:39:05 -06:00
Olaoluwa Osuntokun b2522ef75a Create skeleton for chain notifications
* Goal is to backend agnostic source to chain notifications
* Open channels will communicate with this source to register intent
for critical notifications
* Pending notifications will need to be committed to disk.
* Will also need a journal to ensure no notification is missed
* Later goals include extending this to communicate with 3rd party
outsource services
2015-12-16 14:38:21 -06:00
Olaoluwa Osuntokun dd9552c980 wallet_test: add tests exercising output locking for concurrent safe funding 2015-12-16 13:22:36 -06:00
Olaoluwa Osuntokun f70027fe76 add SegWit to support channel types 2015-12-16 13:04:51 -06:00
Olaoluwa Osuntokun cc6c59a427 wallet_test: ensure funding tx has been properly stored
* Doesn’t yet include checksums, backups, etc
2015-12-15 16:19:17 -06:00
Olaoluwa Osuntokun 6bb5febe9e notes to self
* CAS vs locks
* Daemon storage redundancy+error-detection
* Proper bucket indexing
2015-12-15 16:18:43 -06:00
Olaoluwa Osuntokun 41065a4538 check signatures in test itself, test-node infra not set up 2015-12-15 15:25:22 -06:00
Olaoluwa Osuntokun 46ad8389b2 note to self on steps after funding broadcast 2015-12-15 15:24:43 -06:00
Olaoluwa Osuntokun cd8a4ccfa5 comment out gettxout logic for now, need test-node infrastructure 2015-12-15 15:24:19 -06:00
Olaoluwa Osuntokun 6f9ba620a8 grab the full script instead of just the hash for the change addr 2015-12-15 15:23:56 -06:00
Olaoluwa Osuntokun 4f89f8719c bob's txin shouldn't have the pkscript as the sig :) 2015-12-15 15:23:17 -06:00
Olaoluwa Osuntokun 42880b5b4c fix panic when creating bob-node 2015-12-15 15:22:54 -06:00
Olaoluwa Osuntokun a5d915dea2 mental note to self 2015-12-15 15:22:33 -06:00
Olaoluwa Osuntokun 1cad40aaf0 add "future" open channel to reservation
p2p logic will most likely spawn a grouting to do a blocking read on
this channel. When the channel is written to, that means the funding
transaction is now X blocks deep, and we’ll start to sign commitment
txns do updates etc.
2015-12-15 15:22:18 -06:00
Olaoluwa Osuntokun 9a601241d6 ensure bob sig's are valid, and his output actually exists 2015-12-02 16:51:46 -08:00
Olaoluwa Osuntokun ad8a7cf2f2 write completed funding tx to disk
* Will move to buckets specific to LNID’s in the future
2015-12-02 16:51:21 -08:00
Olaoluwa Osuntokun 92ff9a6bd5 scrap completedFundingState 2015-12-02 16:50:19 -08:00
Olaoluwa Osuntokun 3bf3fa576d make getNextMultiSigKey concurrent-safe 2015-12-02 16:50:00 -08:00
Olaoluwa Osuntokun f8e4ff8edc bare skeleton of funding -> open channel workflow 2015-12-02 16:49:41 -08:00
Olaoluwa Osuntokun ab10677d91 lnwallet_test: initial test testing basic funding reservation workflow 2015-11-29 12:20:16 -08:00
Olaoluwa Osuntokun 5d9b4e73ff lnwallet: fix panic, use append to collect sigs 2015-11-29 12:19:47 -08:00
Olaoluwa Osuntokun dbc9c27758 lnwallet/reservation: properly populate request struct, forgot err chan 2015-11-29 12:19:13 -08:00
Olaoluwa Osuntokun 42ba1a5394 lnwallet/reservation: s/Unlock/RUnlock, fix panic caused by double unlock 2015-11-28 18:20:57 -06:00
Olaoluwa Osuntokun b36de8768d lnwallet: directly get change add for now, not connected to real node 2015-11-28 18:16:00 -06:00
Olaoluwa Osuntokun 627192f493 lnwallet: fix coin selection, translate to satoshis 2015-11-28 18:13:04 -06:00
Olaoluwa Osuntokun 06e5544428 lnwallet: ListUnspent takes int32 not uint32, use math.MaxInt32 instead 2015-11-28 17:28:48 -06:00
Olaoluwa Osuntokun a56d2199a3 wallet_test: stop creating coinbase txns, make wallet think it's synced 2015-11-28 17:13:57 -06:00
Olaoluwa Osuntokun bd37f05ad6 Stop btcwallet when shutting down lnwallet 2015-11-27 18:07:22 -06:00
Olaoluwa Osuntokun bf1a090d1d add some utilities to aide with testing 2015-11-27 00:53:38 -06:00
Olaoluwa Osuntokun 86b274a223 reservation iD embedded in ChannelReservation no need to pass in 2015-11-27 00:52:14 -06:00
Olaoluwa Osuntokun 40a515b3db add some notes to roasbeef (TODO's) 2015-11-27 00:51:01 -06:00
Olaoluwa Osuntokun dfd14d53a5 fill in some forgotten error paths 2015-11-27 00:50:17 -06:00
Olaoluwa Osuntokun 11179bf5c0 RequestChannelReservation -> InitChannelReservation 2015-11-27 00:49:48 -06:00
Olaoluwa Osuntokun 75d7c26e57 import walletdb/bdb for side effects (registers driver) 2015-11-27 00:49:21 -06:00
Olaoluwa Osuntokun 2945b8966d add rpc client to wallet 2015-11-27 00:48:42 -06:00
Olaoluwa Osuntokun 0f1bd0fcdd stop embedding btcwallet causing name conflicts 2015-11-27 00:48:20 -06:00
Olaoluwa Osuntokun 1d1ba454f4 pass db-path+hd-seed into wallet init 2015-11-27 00:46:59 -06:00
Olaoluwa Osuntokun b023120460 add skeleton for shachain packaged
* Still considering if it’s better just to use a modified HD chain or
not:
  * give them child branch/sub-tree etc.
2015-11-18 14:59:51 -08:00
Olaoluwa Osuntokun 5e8a2ed26f add skeleton for initial wallet tests 2015-11-18 14:59:07 -08:00
Olaoluwa Osuntokun ff82c7d40a add constructor for LightningWallet 2015-11-18 14:38:57 -08:00
Olaoluwa Osuntokun f28ca7d9dc add btcsuite license to setup.go 2015-11-18 14:38:29 -08:00
Olaoluwa Osuntokun 58d7afa7d3 introduce setup.go to handle initial wallet setup/create plus openening
* will be useful for future tests
2015-11-18 14:38:15 -08:00
Olaoluwa Osuntokun e17ba7859e add concurrent-safe interface to ChannelReservation state 2015-11-14 11:52:07 -08:00
Olaoluwa Osuntokun 3fad3aabef start of wallet initialization for testing purposes 2015-11-12 19:34:35 -08:00
Olaoluwa Osuntokun 8583814f1f separate out channel init functionality into reservation
* Reservation has synchronous interface, wallet and only wallet should
mutate any of the attributes
2015-11-12 18:43:32 -08:00
Olaoluwa Osuntokun f775e130e3 add note about normalized taxis 2015-11-12 17:45:18 -08:00
Olaoluwa Osuntokun c6e7c6b1b6 scrap the multi-sig key pool, better to just use HD paths
* Better to just keep the single file back-up IMO
2015-11-12 17:45:09 -08:00