Commit Graph

6136 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
184f160fb9
lnrpc: add new sub RPC server registration system
In this commit, we add the scafolding for the future sub-server RPC
system. The idea is that each sub server will implement this particular
interface. From there on, a "root" RPC server is able to query this
registry, and dynamically create each  sub-sever instance without
knowing the details of each sub-server.

In the init() method of the pacakge of a sub-server, the sub-server is
to call: RegisterSubServer to claim its namespace. Afterwards, the root
RPC server can use the RegisteredSubServers() method to obtain a slice
of ALL regsitered sub-servers. Once this list is obtained, it can use
the New() method of the SubServerDriver struct to create a new
sub-server instance.

Each sub-server needs to be able to locate it's primary config using the
SubServerConfigDispatcher interface. This can be a map of maps, or a
regular config structr. The main requirement is that the sub-server be
able to find a config under the same name that it registered with. This
string of abstractions will allow the main RPC server to find, create,
and run each sub-server without knowing the details of its configuration
or its role.
2018-11-28 20:57:00 -08:00
Olaoluwa Osuntokun
9f24049bbc
lnrpc/signrpc: add new gen_protos.sh to generate minimal protos
In this commit, we add a new proto generation script to match the one in
the main lnrpc package. This script differs, as we don't need to
generate the REST proxy stuff (for now).
2018-11-28 20:56:59 -08:00
Olaoluwa Osuntokun
bbbdd7f6e9
lnrpc/signrpc: add and generate new set of protos for Signer service 2018-11-28 20:56:58 -08:00
Olaoluwa Osuntokun
a432f9a4c8 lnrpc/signrpc: create new signrpc package with build-flag guarded config
In this commit, we introduce a new sub-package within the greater RPC
package.  This new sub-package will house a new set of sub-RPC servers
to expose experimental features behind build flags for upstream
consumers. In this commit, we add the first config for the service,
which will simply expose the lnwallet.Signer interface over RPC.

In the default file, we have what the config will be if the build tag
(signerrpc) is off. In this case, the config parser won't detect any
times, and if specified will error out. In the active file, we have the
true config that the server will use. With this new set up, we'll
exploit these build flags heavily in order to create a generalized
framework for adding additional sub RPC servers.
2018-11-28 20:56:38 -08:00
Olaoluwa Osuntokun
b5dd1863f6
Merge pull request #2239 from Roasbeef/go-modules
build: switch from dep to go modules
2018-11-28 20:53:03 -08:00
Olaoluwa Osuntokun
eda45adb5b
docs: update docs to reflect new go modules usage and building 2018-11-28 20:13:56 -08:00
Olaoluwa Osuntokun
f65b1a4d6e
travis: force go modules support in $GOPATH, cache modules directory 2018-11-28 20:13:54 -08:00
Olaoluwa Osuntokun
e2e73379c7
build: update makefile to be aware of go modules, remove dep support
In this commit, we update the makefile to be aware of go modules. Along
the way, we remove all references to dep as we no longer use it within
this project. Note that in order to allow usage of go modules within the
$GOPATH directory, we set the `GO111MODULE=on` environment variable.
2018-11-28 20:13:52 -08:00
Olaoluwa Osuntokun
e5f4b7ca66
travis: remove dep directive from travis, as we use go modules now 2018-11-28 20:13:51 -08:00
Olaoluwa Osuntokun
e6c22d658d
docs: update contribution guidelines to reference latest version of Go
with '#' will be ignored, and an empty message aborts the commit.
2018-11-28 20:13:50 -08:00
Olaoluwa Osuntokun
f09a4daeb1
docs/MAKEFILE: remove obsolete travis section
In this commit, we remove the travis section as the directive has been
removed from the makefile.
2018-11-28 20:13:49 -08:00
Olaoluwa Osuntokun
ca28c0b5a1
docs/MAKEFILE: remove dep section
In this commit, we remove the dep section as we no longer use it, and
instead use go modues.
2018-11-28 20:13:48 -08:00
Olaoluwa Osuntokun
ebff57a1f7
build: remove old stale dep files 2018-11-28 20:13:46 -08:00
Olaoluwa Osuntokun
4a29f56a3f build: add new go.mod and go.sum files for go modules usage 2018-11-28 17:19:10 -08:00
Olaoluwa Osuntokun
4e83ce5c00
Merge pull request #1892 from halseth/travis-caching
travis cache
2018-11-28 17:07:40 -08:00
Olaoluwa Osuntokun
fd82200a15
Merge pull request #2140 from cfromknecht/wtserver-move
[watchtower/wtserver] rename server package, add godocs, general code health
2018-11-28 15:07:01 -08:00
Johan T. Halseth
b07499f227
Merge pull request #2224 from halseth/itest-timeouts
lnd_test: increase test timeouts
2018-11-28 08:22:46 +01:00
Johan T. Halseth
7e48b012e2
Merge pull request #2230 from halseth/itests-tryconnect-peer
lntest/harness: retry ConnectPeer of chain backend still syncing
2018-11-28 08:21:08 +01:00
Johan T. Halseth
0011bcdad1
Merge pull request #2229 from halseth/global-defaultcsv
lnd_test: make tests use global defaultCSV
2018-11-28 08:19:58 +01:00
Olaoluwa Osuntokun
6d4a769203
Merge pull request #2231 from karliatto/change-contribution-guide-link-#2214
Docs: code_contribution_guidelines change link
2018-11-27 15:48:27 -08:00
Johan T. Halseth
8854db5191
gitignore: ignore temp backend logs folder 2018-11-27 10:21:19 +01:00
Johan T. Halseth
4d05e6bbd8
lnd_test+lntest: keep btcd debug logs from test run
Useful for debugging 🤷
2018-11-27 10:21:19 +01:00
Johan T. Halseth
3a2fd51f2f
lnd_test+lntest: move copyFile() -> lntest.CopyFile() 2018-11-27 10:21:17 +01:00
Carlos Garcia Ortiz
0f03120a46 Docs: code_contribution_guidelines change link 2018-11-27 10:20:06 +01:00
Johan T. Halseth
b389d5f6b0
lntest/harness: retry ConnectPeer of chain backend still syncing 2018-11-27 10:15:00 +01:00
Johan T. Halseth
ec76a25530
lnd_test: make test use globale defaultCSV 2018-11-27 10:11:32 +01:00
Johan T. Halseth
62e37ec840
lnd_test: use global defaultTimeout instead of test specific timeouts 2018-11-27 10:01:02 +01:00
Johan T. Halseth
f13e5472d5
lnd_test: use global minerMempoolTimeout when waiting for miner to see TXs 2018-11-27 09:59:46 +01:00
Johan T. Halseth
ea32a13fdb
lnd_test: use global channelCloseTimeout when closing channels 2018-11-27 09:59:31 +01:00
Johan T. Halseth
864d77d82e
lnd_test: use global channelOpenTimeout when opening channels 2018-11-27 09:59:29 +01:00
Olaoluwa Osuntokun
0348db760e
Merge pull request #2221 from Roasbeef/open-channel-sync-fix
rpc: properly set output index in OpenChannelSync resp
2018-11-26 16:36:13 -08:00
ErikEk
6884fe40db Set private setting for invoice 2018-11-26 09:05:37 +01:00
Olaoluwa Osuntokun
a1c39af313
rpc: properly set output index in OpenChannelSync resp
Fixes #2219
2018-11-25 21:13:00 -06:00
Olaoluwa Osuntokun
42c4597921
Merge pull request #1937 from halseth/data-loss-protect-resending
Data loss protect resending
2018-11-25 20:47:16 -06:00
Olaoluwa Osuntokun
28eb8474f4
chainntnfs: modify all historical rescans to scan backwards
In this commit, we modify all existing historical rescans for
ChainNotifier backends to scan backwards rather than forwards. If we
know that a transaction has been confirmed, or outpoint spent, the it's
likely that the event has recently transpired assuming we've been
offline for a short period of time. Therefore, if we scan backwards
rather than forwards, then we can save potentially hundreds or thousands
of block fetches if the event recently happened close to the tip of the
chain.

We bound this search at the genesis block, to ensure we don't underflow
the uint32 used throughout the package in the main loop.
2018-11-24 15:50:12 -06:00
Olaoluwa Osuntokun
8924d8fb20
Merge pull request #2206 from halseth/channel-commitchainheight-remove
[trivial] lnwallet/channel: remove startingHeight from commitmenChain
2018-11-24 15:27:54 -06:00
Johan T. Halseth
5c294601f0
lnwallet/channel: remove startingHeight from commitmentChain
Field is not being used.
2018-11-23 08:58:45 +01:00
Olaoluwa Osuntokun
712fc3ebed
Merge pull request #2205 from valentinewallace/better-sync-info
lnwallet/btcwallet: return best header timestamp while wallet is resc…
2018-11-21 23:06:25 -08:00
Johan T. Halseth
b1a35fc8f4
channeldb/migrations_test: add TestMigrateOptionalChannelCloseSummaryFields 2018-11-21 13:36:42 +01:00
Johan T. Halseth
a9bd6100ff
htlcswitch/link: remove handled TODO 2018-11-21 10:28:57 +01:00
Johan T. Halseth
0c4948b40b
lnd test: add offline scenario to testDataLossProtection
This adds the scenario where a channel is closed while the node is
offline, the node loses state and comes back online. In this case the
node should attempt to resync the channel, and the peer should resend a
channel sync message for the closed channel, such that the node can
retrieve its funds.
2018-11-21 10:28:57 +01:00
Johan T. Halseth
9e81b1fe53
chain_watcher: poll for commit point in case of failure
We pool the database for the channel commit point with an exponential
backoff. This is meant to handle the case where we are in process of
handling a channel sync, and the case where we detect a channel close
and must wait for the peer to come online to start channel sync before
we can proceed.
2018-11-21 10:28:57 +01:00
Johan T. Halseth
0dd7eed64e
peer: define resendChanSyncMsg
This method is used to fetch channel sync messages for closed channels
from the db, and respond to the peer.
2018-11-21 10:28:56 +01:00
Johan T. Halseth
da3f515f12
channeldb/db_test: add TestFetchClosedChannelForID 2018-11-21 10:28:56 +01:00
Johan T. Halseth
45b132a954
channeldb/db: define FetchClosedChannelForID
FetchClosedChannelForID is used to find the channel close summary given
only a channel ID.
2018-11-21 10:28:56 +01:00
Johan T. Halseth
a9f93b2988
contractcourt/chain_watcher: add channel sync message to CloseChannelSummary 2018-11-21 10:28:56 +01:00
Johan T. Halseth
676a1b1407
lnwallet+link: make ChanSyncMsg take channel state as arg
This lets us get the channel reestablish message without creating the LightningChannel struct first.
2018-11-21 10:28:56 +01:00
Johan T. Halseth
0b9a323fcb
channeldb/channel: add LastChanSync field to CloseChannelSummary
This commit adds an optional field LastChanSyncMsg to the
CloseChannelSummary, which will be used to save the ChannelReestablish
message for the channel at the point of channel close.
2018-11-21 10:28:43 +01:00
Johan T. Halseth
46c961aa17
channeldb/migrations: migrate ChannelCloseSummary 2018-11-21 10:27:58 +01:00
Johan T. Halseth
28b15dcbbb
channeldb/channel: write boolean to indicate presence of ChannelCloseSummary fields 2018-11-21 10:27:58 +01:00