Joseph Poon
f51a5a6458
Holy shit pointer crap was annoying! Serialize/deserialize works now.
...
Running "go test -v" will show the serialization and deserialization.
Doing the rest of the wire stuff should be *much* faster since I figured
everything out...
2015-12-26 23:52:20 -08:00
Joseph Poon
0c0900006d
Upon further reflection Our/Their seperation makes no sense
2015-12-26 20:37:17 -08:00
Joseph Poon
b79d0cc65a
(still need to fix deserialize... io wasn't working so I'm using bytes)
2015-12-26 18:23:58 -08:00
Joseph Poon
09f07770fd
Funding request serialize/deserialize (io reader/writer and pointers
...
were very confusing -_-;)
2015-12-26 18:20:25 -08:00
Olaoluwa Osuntokun
7990d9501a
Merge branch 'master' of li.lan:labs/plasma
2015-12-26 12:35:42 -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
a10a678505
add some daemon related skeleton files
2015-12-26 00:09:17 -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
Olaoluwa Osuntokun
b4e33587b1
lnwallet: switch to using channeldb
2015-12-26 00:05:55 -06:00
Olaoluwa Osuntokun
ff92efe7df
lnwallet: add node's ID to reservation workflow
2015-12-26 00:05:07 -06:00
Olaoluwa Osuntokun
4bb526854a
lnwallet: fix bug don't set TheirCommitSig twice
2015-12-26 00:03:53 -06:00
Olaoluwa Osuntokun
e345f72d69
lnwallet: implement FetchOpenChannel and PutOpenChannel
2015-12-25 18:00:44 -06:00
Olaoluwa Osuntokun
1386d798f5
lnwallet: add tests for serialization of OpenChannelState
2015-12-25 17:00:53 -06:00
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
Joseph Poon
fc9ebb52f3
Refactor funding request, will separate to multiple files later
2015-12-23 00:08:34 -08: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
Joseph Poon
55c8710cb9
Minor optimization in script opcodes
2015-12-22 16:45:21 -08:00
Tadge Dryja
fbc5f37d0b
remove dependencies on mathematics
2015-12-21 22:36:28 -05: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