Commit Graph

2410 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
1ce6c4668e
funding: unconditionally forward all received errors to client
Previously, our old lnwire.Error message used a special code to
indicate different types of errors. With the recent push for spec
compatibility, we removed this field and instead stuffed the error into
the first byte of the error data. This works between lnd nodes, but
with other implementations they may send different errors which use a
different error scheme.

To fix this, we’ll now unconditionally return the error to the end
caller (if one exists).
2017-08-30 20:31:40 -07:00
Olaoluwa Osuntokun
7be039adec
multi: ensure that BlockEpoch clients are cancelled
This commit fixes a prior goroutine leak that could result in a node
having thousands of goroutines, particularly due to many concurrent
channel fundings. We now ensure that for each BlockEpoch client
created, we ensure that the client is cancelled once the creating
grouting exits.
2017-08-30 20:26:17 -07:00
Dave Collins
916ab454c1 channeldb: Fix payment serialization tests.
This modifies the tests that deal serializing the Invoice type to limit
the creation date to seconds since Go1.9 added the concept of a
monotonic component to times which does not round trip through
MarshalBinary and UnmarshalBinary and therefore causes the tests to fail.

In particular, it modifies the creation dates in the randInvoice,
makeFakePayment, makeRandomFakePayment, and TestInvoiceWorkflow
functions.

This results in allowing TestOutgoingPaymentSerialization,
TestOutgoingPaymentWorkflow, and TestInvoiceWorkflow to pass.
2017-08-30 18:57:39 -07:00
Dave Collins
42a263b29f wire: Correct fuzz test for MsgCommitSig.
This corrects the fuzz test in TestLightningWireProtocol for
MsgCommitSig to avoid creating an empty slice since the decoded message
only creates a slice when there are greater than zero signatures and an
empty slice is not considered equal to a nil slice under reflection.

This can be tested by running the TestLightningWireProtocol 1000 times
in a loop with and without this change.
2017-08-30 18:07:33 -07:00
Dave Collins
fc5d307c1a docs: Correct a couple of typos in README.md. (#290) 2017-08-30 17:34:28 -07:00
Olaoluwa Osuntokun
a43e9c6883
peer: check for ErrEdgeNotFound when loading chan edge for fwrding policy
This commit adds a precautionary check for the error returned if the
channel hasn’t yet been announced when attempting to read the our
current routing policy to initialize the channelLink for a channel.
Previously, if the channel wasn’t they announced, the function would
return early instead of using the default policy.

We also include another bug fix, that avoids a possible nil pointer
panic in the case that the ChannelEdgeInfo reread form the graph is
nil.
2017-08-30 15:34:27 -07:00
Olaoluwa Osuntokun
a52d405998
lnwallet: ensure HTLC values are properly converted to SAT in commit tx
This commit fixes a bug within the HTLC construction and commitment
transaction construction that would result in HTLC _values_ within the
commitment transaction being off by a factor of 1000. This was due to
the fact that we failed to convert the amount of an HTLC, in mSAT, to
SAT before placing it as an output within the commitment transaction.
When attempt to locate the output index of a particular half, we use
the unconverted amount, meaning it was unnoticed.

This commit adds a new assertion within the TestSimpleAddSettleWorkflow
test to ensure that the HTLC is found within the commitment transaction
with the proper value in satoshi.
2017-08-30 15:34:18 -07:00
Olaoluwa Osuntokun
af52aa838e
build: update glide commit hash to latest btcd+neutrino
This commit updates the glide hashes for btcd, neutrino, and btcwallet
to their latest versions. This change was prompted, as we've recently
fixed two bugs: one in btcd, and one in neutrino. The btcd in btcd was
due to not properly setting a pointer, which caused the new gcs related
RPC calls to now respond correctly. The neutrino bug was due to a nil
pointer panic that was triggered by not ensuring that we actually had a
`syncPeer` before referencing it.
2017-08-29 15:38:42 -07:00
Olaoluwa Osuntokun
19a843016e
build: update glide.lock to point to latest ltcd 2017-08-25 18:04:14 -07:00
Conner Fromknecht
4248836a2a lnd_test: use fresh Carol node for breach itest 2017-08-25 17:56:50 -07:00
Conner Fromknecht
85b76570ef lnd_test: increase startup timeout for breach itests 2017-08-25 17:56:50 -07:00
Conner Fromknecht
43b469be5a lnd_test: switch btcrpcclient to rpcclient 2017-08-25 17:56:50 -07:00
Conner Fromknecht
501e1dae23 breacharbiter_test: improves documentation for ba test cases 2017-08-25 17:56:50 -07:00
Conner Fromknecht
cfe1530205 breacharbiter: makes newline formatting consistent with lnd 2017-08-25 17:56:50 -07:00
Conner Fromknecht
c0f1d12521 utxonursery: refactors kidOutput SignDescriptor serialization 2017-08-25 17:56:50 -07:00
Conner Fromknecht
438c6b9621 lnwallet: move latest SignDescriptor + serialization 2017-08-25 17:56:50 -07:00
Conner Fromknecht
b7e426ecdc lnd_test: test breach persistence after breach conf 2017-08-25 17:56:50 -07:00
Conner Fromknecht
ce17d18249 breacharbiter_test: adds RetributionStore persistence unit tests 2017-08-25 17:56:50 -07:00
Conner Fromknecht
c3736e6893 breacharbiter: adds persistence to retribution flow
This commit introduces a RetributionStore interface, which
  establishes the methods used to access persisted information
  regarding breached channels. A RetributionStore is used to
  persist retributionInfo regarding all channels for which
  the wallet has signaled a breach.

  The current design could be improved by moving certain
  functionality, e.g. closing channels and htlc links, such
  that they are handled by upstream by their respective
  subsystems. This was investigated, but deemed preferable to
  postpone to a later update to prevent the current
  implementation from sprawling amongst too many packages.

  The test suite creates a mockRetributionStore and ensures that
  it exhibits the same behavior as the retribution store backed
  by a channeldb.DB.
2017-08-25 17:56:50 -07:00
Conner Fromknecht
6ffe33f01a lnw+ba+utxon+cdb: reverts OutPoint and TxOut encoding 2017-08-25 17:56:50 -07:00
Conner Fromknecht
8698085e35 breacharbiter: reverts retributionInfo naming and realign diffs 2017-08-25 17:56:50 -07:00
Conner Fromknecht
4cdce1fc0a breacharbiter+channeldb: resolves rebase conflicts 2017-08-25 17:56:50 -07:00
Philip Hayes
ce411f8e22 lint: fix linter complaints 2017-08-25 17:56:50 -07:00
Philip Hayes
56793a1041 utxonursery: finish migrating to lnwire OutPoint serialization 2017-08-25 17:56:50 -07:00
Philip Hayes
b19c483a04 breacharbiter: add retribution state persistence
This commit adds a breached contract retribution storage layer using
boltdb to the breach arbiter. The breach arbiter now stores retribution
state on disk between detecting a contract breach, broadcasting a
justice transaction that sweeps the channel, and finally witnessing the
justice transaction confirm on the blockchain. It is critical that such
state is persisted on disk, so that if our node restarts at any point
during the retribution procedure, we can recover and continue from the
persisted state.
2017-08-25 17:56:50 -07:00
Philip Hayes
d8c56433e3 lnwallet: extract SignDescriptor serialization and witness generator 2017-08-25 17:56:50 -07:00
Philip Hayes
f0aa186a56 channeldb+utxonursery+lnwire: use lnwire's OutPoint,TxOut serialization 2017-08-25 17:56:50 -07:00
Olaoluwa Osuntokun
7f575b688e
multi: txscript.WitnessScript -> txscript.WitnessSignature 2017-08-24 18:55:32 -07:00
Olaoluwa Osuntokun
9f0efddc20
multi: switch from btcrpcclient to rpcclient 2017-08-24 18:54:24 -07:00
Olaoluwa Osuntokun
ac128e4545
build: update glide files to point to latest btcsuite repos
This commit updates the glide packages in the repo to point to the
latest btcsuite repos. With this change, we’ll now be able to take
advantage of many of the recent updates to the btcsuite package of
repos. One highlight is that after this commit, we’ll now be using
bech32 by default for p2wkh addresses.
2017-08-24 18:44:58 -07:00
Olaoluwa Osuntokun
4e48a8cb86
docs: update installation docs, specify min version
This commit updates the installation docs to specify the min golfing
version. Additionally, we ensure that users running on linux will
download the latest version of golfing from their ppa. Finally, we also
now link directly to the golfing page of pre-compiled binaries for
users that seek to grab the source directly from the official goading
website.

Fixes #263.
2017-08-24 14:09:29 -07:00
Chris Moore
493d7b53f6 docs: add 'git clone' line for btcd installation
The installation instructions for btcd were missing a 'git clone' command.
2017-08-24 14:02:31 -07:00
Olaoluwa Osuntokun
48712526d6
lnd+cmd/lncli: bump to version 0.3 2017-08-23 11:57:01 -07:00
Olaoluwa Osuntokun
d4d5198e85
peer: if we don't have an advertised routing policy, fall back to default
This commit fixes a bug that could arise if either we had not, or the
remote party had not advertised a routing policy for either outgoing
channel edge. In this commit, we now detect if a policy wasn’t
advertised, falling back to the default routing policy if so.

Fixes #259.
2017-08-23 11:34:53 -07:00
Olaoluwa Osuntokun
d0b192c636
discovery: print proper error message when sigs fail to validate 2017-08-23 11:34:47 -07:00
Olaoluwa Osuntokun
6e3abdfd14
macaroons: ensure all bytes read from db are copied before returning
This commit is a precautionary commit put in place in order to ensure
that the logic of macaroon retrieval doesn’t run into a bug triggered
by returning a reference into bolt’s active memory map. This can arise
if one returns a pointer directly read from the database. We seek to
avoid this by instead ensuring all byte slices are fully copied before
returning.
2017-08-23 11:34:43 -07:00
Olaoluwa Osuntokun
ae5afcf555
docs: update installation notes with neutrino info 2017-08-22 21:01:24 -07:00
Olaoluwa Osuntokun
1ff389b449
README: update with latest information 2017-08-22 21:00:46 -07:00
Olaoluwa Osuntokun
ff997eab3e
discovery: ensure ChainHash field is populated when crafting new ChannelUpdates
This commit ensures that we *always* populate the ChainHash field when
we’re crafting new channel update messages either due to the periodic
broadcast, or when we’re updating the routing policies of a set of
target channels. Previously, this wasn’t set which would cause nodes to
reject the newly crafted ChannelUpdate messages.
2017-08-22 20:13:04 -07:00
Olaoluwa Osuntokun
2d45552ad9
htlcswitch: properly format chan_id on failure to find 2017-08-22 20:12:56 -07:00
Olaoluwa Osuntokun
90a03954b2
htlcswitch: fix linter errors 2017-08-22 01:05:32 -07:00
Olaoluwa Osuntokun
2b2a3714c1
multi: fix linter errors 2017-08-22 01:00:12 -07:00
Olaoluwa Osuntokun
ed3268b988
test: in testSingleHopInvoice also wait for bob to advertise the channel 2017-08-22 00:54:20 -07:00
Olaoluwa Osuntokun
321cc28cd8
routing: in findPath skip edge if incoming edge isn't advertised 2017-08-22 00:54:15 -07:00
Olaoluwa Osuntokun
c1aed90e72
docker: update containers to expose new default port 2017-08-22 00:54:12 -07:00
Olaoluwa Osuntokun
625b80b311
config: update default port to be 9735 to match BOLT-0001 2017-08-22 00:54:10 -07:00
Olaoluwa Osuntokun
08d22f8bb4
lnd: modify htlc error integration tests to account for max payment size
This commit modifies the HTLC integration tests to be mindful of the
max payment size. Rather than sending the payment in one large batch,
we instead now send it in chunks of the max payment size.
2017-08-22 00:54:07 -07:00
Olaoluwa Osuntokun
65526ba071
lnd: reset features as we no longer need to partition dated lnd nodes 2017-08-22 00:54:04 -07:00
Olaoluwa Osuntokun
1c22242a41
build: update glide files to track latest gRPC related repos/commits 2017-08-22 00:54:02 -07:00
Olaoluwa Osuntokun
2790617176
cmd/lncli: add command+parsing for updatefees and feereport 2017-08-22 00:53:59 -07:00