Commit Graph

450 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun cad0d54e43
lnd: make the http profiling server optional w/ a config param 2016-06-21 13:12:51 -07:00
Olaoluwa Osuntokun c5f97a17d5
channeldb: introduce FetchOpenChannels
This commit introduces/re-writes a method FetchOpenChannels for
channeldb, which returns all currently active/open channels for a
particular peerID.
2016-06-21 13:12:47 -07:00
Olaoluwa Osuntokun c2818a549b
channeldb: modify schema to multiple-channels-per-peer
This commit overhauls the current schema for storing active channels in
order to support tracking+updating multiple open channels for a
particular peer.

Channels are now uniquely identified by an output (txid:index) rather
than an arbitrary hash value. As a result, the funding transaction is
no longer stored, as only the txin is required to lookup the original
transaction, and to sign for new commitment states.

A new bucket, nested within the bucket for a node’s Lightning ID has
been created. This new bucket acts as an index to the active channels
for a particular peer by storing all the active channel points as keys
within the bucket. This bucket can then be scanned in a linear fashion,
or queried randomly in order to retrieve channel information.

The split between top-level, and channel-level keys remains the same.
The primary modification comes in using the channel ID (the funding
outpoint) as the key suffix for all top-level and channel-level keys.
2016-06-21 13:12:43 -07:00
Olaoluwa Osuntokun 43c84c2ce5
chainntfs: include height in spending+conf notifications 2016-06-21 13:12:39 -07:00
Olaoluwa Osuntokun 7bff2e07a8
chainntfs: add new RegisterBlockHeightNtfn method
This commit adds a new method to the ChainNotifier interface which
subscribes the caller to a continuous stream of notifications generated
by new blocks added to the tip of the Bitcoin main chain.

Concurrently, this method is intended to be used in order to obtain the
necessary block height information to properly handle the timeout
period on any pending HTLCs. A continuos stream, rather than a one-off
notification is chosen in order to discourage a goroutine-per-HTLC
model which would be rather wasteful.
2016-06-21 13:12:35 -07:00
Olaoluwa Osuntokun 1879c00c55
chainntfs: further specify behavior of RegisterSpendNtfn
This commit updates the documentation for the chainntfs interface to
specify that notifications for spends registered with
`RegisterSpendNtfn` should be triggered *only* once a transaction
spending the target outpoint is *seen* within the network.

This strictness is required in order to allow an ‘honest’ counter-party
to properly sweep funds within channels with short delays.
2016-06-21 13:12:31 -07:00
Olaoluwa Osuntokun 3f0173f19a
chainnfts: export logger for use by concrete implementations 2016-06-21 13:12:27 -07:00
Joseph Poon 889b43a06b
Initial travis yml file 2016-06-21 13:12:21 -07:00
Olaoluwa Osuntokun 3b6e456371
lnwire: revamp previous encode/decode tests to passing state 2016-05-30 20:52:25 -07:00
Olaoluwa Osuntokun 83b11c5efe
lnwire: fix writeElement [][20]byte bug
Passing the [20]byte as a *[20]byte results in a type switch error as
there isn’t a case for that type within writeElement.
2016-05-30 20:52:17 -07:00
Olaoluwa Osuntokun 4d763e07f7
lnwire: add basic encode/decode tests for single funder workflow 2016-05-30 20:52:13 -07:00
Olaoluwa Osuntokun 9978d889b7
lnwire: add missing cases in [read/write]Element
Add cases to encode/decode wire.OutPoint, and a final line to properly
write out signatures fully.
2016-05-30 15:45:01 -07:00
Olaoluwa Osuntokun 61994bc294 Merge pull request #12 from RCasatta/master
Updating Readme with reference to Segnet4 instead of testnet-L
2016-05-23 13:59:51 -07:00
Olaoluwa Osuntokun 913ae259de
lnwire: document commitment+HTLC update msgs
This commit adds some cursory documentation along wit minor field
modifications to all messages which deal with adding HTLC’s, or
updating remote commitment transactions.

The messages for dual funding of channel is left purposefully
undocumented as all initial negotiations will be single funder by
default.

A revamp of the testing infrastructure of lnwire will be committed in
the near future.
2016-05-23 13:54:41 -07:00
Olaoluwa Osuntokun b202831868
lnwire: update/document [read/write]Element funcs 2016-05-23 13:51:26 -07:00
Olaoluwa Osuntokun 2073fa42a7
lnwire: document lnwire specific data structures 2016-05-23 13:50:39 -07:00
Olaoluwa Osuntokun a30831aef8
lnwire: update and document message.go 2016-05-23 13:49:14 -07:00
Olaoluwa Osuntokun 0563205e6d
lnwire: update isValidPkScript for segwit scripts 2016-05-23 13:48:17 -07:00
Olaoluwa Osuntokun 8dc284db02
lnwire: update tests to new wire.TxIn API
Syncing to match upstream btcd segwit branch.
2016-05-23 13:47:29 -07:00
Olaoluwa Osuntokun 1a617fcccb
lnwire: add SingleFundingOpenProof message
The SFOP is the final message sent during the single funding channel
negotiation protocol. Once Alice sends the SFOP message to Bob, Bob
will then commit resources to watching and updating the newly created
channel with Alice.
2016-05-23 13:46:48 -07:00
Olaoluwa Osuntokun 18314f73ae
lnwire: document and update SingleFundingResponse 2016-05-23 13:46:26 -07:00
Olaoluwa Osuntokun 3bf2d62035
lnwire: document start of single funder workflow
This commit adds some additional documentation in the form of comments
to the start of the revised single funder workflow.

A primary change lies in the introduction of the exchange of Channel
Derivation Points (CDP’s) for both sides. Using CDP’s we can derive
channel authentication proofs which are both unforgettable and binding.
2016-05-23 13:40:45 -07:00
Olaoluwa Osuntokun f799ff3b66
lnwire: add SingleFundingSignComplete msg to workflow
This commit adds the SingleFundingSignComplete message to the single
funder transaction workflow. This marks the second to last message sent
in the workflow. The message transports Bob’s signature for the
commitment transaction, allowing Alice to broadcast the funding
transaction as she can now refund her inputs.
2016-05-22 22:29:52 -07:00
Olaoluwa Osuntokun 59a65518c1
lnwire: add SingleFundingComplete to single funder
This commit adds the SingleFundingComplete message to the single funder
channel workflow. This is the 3rd message sent in the workflow,
traveling from Alice to Bob once Alice is able to construct the final
commitment transaction.
2016-05-22 22:25:52 -07:00
Olaoluwa Osuntokun 6eaf4908fb
uspv: update to new upstream btcd api to fix compile errors 2016-05-22 22:04:25 -07:00
Joseph Poon 566bf47cbf Wire update
More in sync with other code! :D
2016-05-17 21:28:42 -07:00
Olaoluwa Osuntokun fcff17c336
multi: change all imports to roasbeef's forks
This commit will allow the general public to build lnd without jumping
through hoops setting up their local git branches nicely with all of
our forks.
2016-05-15 17:22:37 +03:00
Riccardo Casatta 46bd85d21e Updating Readme with reference to Segnet4 instead of testnet-L 2016-05-10 18:32:11 +02:00
Olaoluwa Osuntokun f78283a438
chainnfts/btcdnotify: update test to upstream API change.
rpctest.Harness.CoinbaseSpend now takes a list of outputs rather, than
a map from address to output amount.
2016-05-03 20:47:24 -07:00
Olaoluwa Osuntokun d09f858501
sighash143: remove directory
This directory is no longer needed as segwit has been fully implemented
in my fork of btcd: github.com/roasbeef/btcd.
2016-05-03 20:46:00 -07:00
Olaoluwa Osuntokun c6eedafb9a
lnwallet: update reservation workflow to be segwitty
Only nested p2sh or pure witness outputs are used when selecting coins
for inputs to a funding transaction.

The funding transaction output now uses p2wsh rather than regular p2sh.

All tests have been updated accordingly.
2016-05-03 20:06:58 -07:00
Olaoluwa Osuntokun 4b4c0f73b0
lnwallet: add ListUnspentWitness for funding tx coin selection 2016-05-03 20:06:49 -07:00
Olaoluwa Osuntokun 0e74672797
lnwallet: use InputScripts struct within ChannelReservation
This allows the reservation workflow to support pure witness program
outputs, as well as witness programs nested within p2sh.
2016-05-03 20:06:44 -07:00
Olaoluwa Osuntokun eeb2887fe9
lnwallet: segwit-ify all scripts and signing utils 2016-05-03 20:06:39 -07:00
Olaoluwa Osuntokun 163eb8dcb8
lnwallet: remove FundingType enum
Removing as segwit is now the path forward.
2016-05-03 20:06:30 -07:00
Olaoluwa Osuntokun 20f5ff56eb channeldb: fix imports 2016-05-03 20:02:46 -07:00
Tadge Dryja 71231c477c make imports lowercase 2016-04-30 20:24:57 -07:00
Olaoluwa Osuntokun 1a96e4f7a6 lnwallet: default to p2wkh address for generated change+delivery addresses 2016-04-24 20:27:56 -07:00
Olaoluwa Osuntokun 35bbf53e59 cmd/lncli: command line parsing for address types for 'newaddress' 2016-04-24 20:27:19 -07:00
Olaoluwa Osuntokun bba8770bb4 lnrpc: add address type param to NewAddress
The new available address types are: regular p2pkh, p2wkh, and finally
p2wkh nested within p2sh. The latter address type will initially be
used to allow users to “fund” the lnd wallet.
2016-04-24 20:26:32 -07:00
Olaoluwa Osuntokun 9982bf4c33 use lnwallet's Shutdown method instead of btcwallet's inner Stop 2016-04-24 12:40:40 -07:00
Olaoluwa Osuntokun 1dfe344c4d p2p listener should only log an error if not shutting down 2016-04-24 12:40:23 -07:00
Olaoluwa Osuntokun 0e607c1939 lnwallet: during shutdown properly wait for all goroutines to exit 2016-04-24 12:39:43 -07:00
Olaoluwa Osuntokun 2b047ff56c lnrpc: update golang proto compiler
The newest version has changed the generated gRPC source files a bit.
If you’re running the _newset_ version of gRPC against the previously
generated code, you’ll get a compile error.

This commit fixes the above behavior.
2016-04-24 12:38:47 -07:00
Olaoluwa Osuntokun fc06c7bffb lndc: use constant time comparison to verify DH proof 2016-04-24 12:37:27 -07:00
Olaoluwa Osuntokun ea49b15e70 pass in net params during channeldb initialization 2016-04-24 12:37:09 -07:00
Olaoluwa Osuntokun 3e3c028313 default net params to segnet4 2016-04-24 12:36:45 -07:00
Olaoluwa Osuntokun fa1e7a332f channeldb: remove hardcoded netparams 2016-04-24 12:35:52 -07:00
Olaoluwa Osuntokun 1e35018e89 lnwallet: fix compile errors against btcd's segwit branch 2016-04-12 21:37:08 -07:00
Olaoluwa Osuntokun f9a8dcbc9c lnwallet: add ListUnspentWitness to WalletController
This method has been added in order to allow lnd to collect eligible
unspent witness programs outputs from the wallet controller for use as
inputs to the funding transaction.

Additionally, the change address functions now also specify whether the
generated change address should be payable to a witness program or not.
2016-04-12 21:36:41 -07:00