Commit Graph

2139 Commits

Author SHA1 Message Date
Conner Fromknecht 84abc962c4
lnwallet/witnessgen: adds htlc offered+accepted revoke witness type 2017-09-19 19:18:21 -07:00
Conner Fromknecht faf1d40bd0
lnwallet/channel: adds directionality htlc retributions
This commit also adds an incoming flag to
        HtlcRetribution struct to allow the breach arbiter to
        generate the appropriate witness based on the htlc's
        directionality.

        It also ensures that the size of the htlc retribution
        slice is now determined by the size of the number of
        htlcs present in the revoked snapshot, which fixes a
        minor bug that could lead to nil pointer deferences.
2017-09-19 19:18:20 -07:00
Conner Fromknecht 7ee7bf840a
breacharbiter_test: properly assigns SignDescriptor w/o ptr 2017-09-19 19:18:20 -07:00
Conner Fromknecht e32d3024ae
server: instantiate breacharbiter using BreachConfig 2017-09-19 19:18:20 -07:00
Conner Fromknecht a8d667ba35
breacharbiter: sweep incoming + outgoing htlcs
This commit also adds a BreachConfig to abstract
  the instantiation of the breach arbiter, as well
  as various formatting improvements.
2017-09-19 19:18:20 -07:00
Conner Fromknecht b64d4356c1
lnd_test: adds breach test for remote hodl
This commit alters the existing retribution
  post breach conf test case with the intention
  of testing the correct response in event that
  the remote party broadcasts a prior state
  while HTLCs have been extended. This serves
  as a preliminary integration for an expansion
  of the breach arbiter integration tests.

  The primary change involves using the new
  htlchodl mode for debugging, which causes the
  remote peer to ignore any intent to settle
  incoming HTLCs. The result is that any
  payments sent to the remote party are held in
  limbo, allowing us to test for these
  conditions more accurately.

  Currently the test case only tests that the
  justice transaction is mined. After we have
  fully integrated the breach arbiter to sweep
  2nd layer HTLCs, this test will be altered
  to check for spends from the appropriate
  inputs.
2017-09-19 19:18:20 -07:00
Conner Fromknecht b3a80f7628
lnwallet/size: updated with recent BOLT 5 constants 2017-09-19 19:18:19 -07:00
Conner Fromknecht f0ac991979
breacharbiter: use BOLT 5 constants 2017-09-19 19:18:19 -07:00
Conner Fromknecht 7f93aec31c
utxonursery: remove use of pointer to lnwallet.Signer iface 2017-09-19 19:18:19 -07:00
Conner Fromknecht da250cd79b
lnwallet/witnessgen: remove use of pointer to Signer iface 2017-09-19 19:18:19 -07:00
Conner Fromknecht 9cc9977f95
breacharbiter_test: modify test vectors to support new structs 2017-09-19 19:18:19 -07:00
Conner Fromknecht d88804178e
breacharbiter: unifies ba sweep txn creation 2017-09-19 19:18:14 -07:00
Olaoluwa Osuntokun a314e661bd
build: update to latest lighting-onion commit
This commit updates `lnd` to the latest version of our Sphinx repo as
it has included a bug fix to use the proper version within the Sphinx
routing header.
2017-09-19 18:11:14 -07:00
whythat 1379488e72 macaroons: rename PermissionsConstraint to AllowConstraint 2017-09-19 16:46:20 -07:00
whythat 7df503575c macaroons: add error reporting for macaroon constraints 2017-09-19 16:46:20 -07:00
whythat 679e86174f macaroons: add IP lock macaroon constraint 2017-09-19 16:46:20 -07:00
whythat a6b9155150 macaroons: use constraint layer for macaroon tweaking 2017-09-19 16:46:20 -07:00
whythat 5c3493bd30 macaroons: add constraint/checker options layer 2017-09-19 16:46:20 -07:00
nsa d65f17f1b1 fuzzing: fixed calculation of serializedSize() in features.go
This commit fixes an incorrectly calculated size of a
*FeatureVector in the serializedSize() function. go-fuzz
found that when calling NewFeatureVectorFromReader, if
a flag is invalid, it is not added to f.flags. However,
it will skip the index that wasn't included. This
becomes a problem when serializedSize() calculates the
length of f.flags via len() which can lead to an index
out of range since certain flags may be missing.
2017-09-19 16:21:31 -07:00
Johan T. Halseth 7662ea5d4d invoice: Add invoice package
The invoice package can be used to encoded and decode invoices
in the format defined in BOLT-0011. This format utilizes bech32
encoding to create invoices that can be shared and understood
by the different Lightning implementations.
2017-09-19 12:05:58 -07:00
Johan T. Halseth ff4ca664e3 lnwire: export SerializeSigToWire and DeserializeSigFromWire 2017-09-19 12:05:58 -07:00
Conner Fromknecht 74322a99be config+htlclink+peer: htlc hodl mode!
This commit adds a new debug mode for lnd
  called hodlhtlc. This mode instructs a node
  to refrain from settling incoming HTLCs for
  which it is the exit node. We plan to use
  this in testing to more precisely control
  the states a node can take during
  execution.
2017-09-19 11:31:52 -07:00
John 8fc14a7308 rpc: add additional go 1.8 TLS cipher suites 2017-09-19 05:45:31 +02:00
Pat White d0685730bd docker: don't specify datadir in lnd container
In this commit, we fix a lingering issue in the execution 
of the lnd container, after the new macaroon based 
authentication was added. With the new authentication 
feature, if the datadir was changed, but `lncli` wasn't 
updated to point to the macaroon path, then none of 
the commands would work. 

To fix this, we simply omit setting the data directory.
2017-09-19 05:42:48 +02:00
halseth 8693e8babc channeldb: check chanIndex bucket for nilness instead of edges 2017-09-19 05:40:29 +02:00
funyug 90d13cf70c README: fix incorrect links to dev sites
This commit fixes two incorrect links in the readme to
dev.lightning.community and api.lightning.community. The two links were
lacking the http:// prefix, and Github's parser didn't automatically
recognize the new TLD. As a result, the links wouldn't automatically
show as clickable. With this commit, we've added the prefix, ensuring
that the links are properly clickable.
2017-09-18 20:26:23 -07:00
Olaoluwa Osuntokun f9ca4631ff
lnwire: fix linter error 2017-09-18 17:40:29 -07:00
Olaoluwa Osuntokun 6e7fcac1f5
lnwire: properly encode/decode addrs in NodeAnnouncement msg
This commit fixes an existing deviation in the way we encode+decode the
addresses within the NodeAnnouncement message with that of the
specification. Prior to this commit, we would encode the _number_ of
addresses, rather than the number of bytes it takes to encode all the
addresses.

In this commit, we fix this mistake by properly writing out the total
number of bytes, modifying our parsing to take account of this new
encoding.
2017-09-18 17:27:51 -07:00
Olaoluwa Osuntokun 3e97aa3931
test: within testListPayments also wait for bob to learn of channel 2017-09-18 17:16:47 -07:00
Olaoluwa Osuntokun dc39d3f2c5
lnwire: fix minor typo in tests 2017-09-18 19:46:16 +02:00
Olaoluwa Osuntokun e3717485f5
lnwire: fix bug in wire.OutPoint -> lnwire.ChannelID conversion
This commit fixes an existing, unnoticed bug within the lnwire.
NewChanIDFromOutPoint function. Two lingering issues cause the function
to not do anything at all, meaning that the channel ID, would be the
exact same as the actual txid passed in.

The first issue was that the xorTxid function wasn’t actually XOR’ing
the last two bytes. This was due to the fact that the function wasn’t
taking a pointer to the target ChannelID, meaning that the mutation
wouldn’t be seen outside of the scope of the function. Second, we had
our slicing reversed, rather than buf[30:], we were using buf[:30],
meaning that we were weren’t properly filling the buffer with the lower
2-bytes of the passed index.
2017-09-18 19:45:11 +02:00
Olaoluwa Osuntokun b58ef85513
lnwire: make test clause within TestChannelIDOutPointConversion stricter
This commit modifies the main test loop within
TestChannelIDOutPointConversion stricter. With this commit, we now
ensure that the conversion function actually does _something_. This is
the first in a series of commits to fix a recently discovered bug
within the outpoint to channel ID conversion routines.
2017-09-18 19:42:19 +02:00
Olaoluwa Osuntokun 31d53c6070
funding: properly display pending chan ID within logs
This commit corrects a minor formatting error when logging the pending
channel ID within the logs. Previously, the logging directives and
parameter could cause the pending chan ID to display in a double-hex
encoded format. We fix this by ensuring that we properly slice the chan
ID before printing it, and also ensure that we use the %x formatting
(which will hex encode the bytes) everywhere.

Fixes #331.
2017-09-18 19:33:43 +02:00
nsa d97575d6d2 lnwire: ensure that addrs in ClosedSigned are below 35 bytes
This is a very simple bug that go-fuzz found. If length of an address
within CloseSigned is greater than 34, a runtime error: slice bounds out
of range happens. An error should be returned instead.
2017-09-14 14:23:49 +02:00
Conner Fromknecht 8ef2263e46 lnwallet: move txout serialization out of lnwire 2017-09-14 13:56:25 +02:00
Johan T. Halseth 4bae23a9a7 docker: update readme
Changes the second docker-compose command to "run" instead of "up",
since this was failing for several people. Also removes the use of
the --num_conf flag to lncli openchannel, as this was removed in
0dfe733.
2017-09-14 13:53:05 +02:00
Mrmaxmeier 383b50acb8 fix typo in doc comment (1000 mSAT == 1 SAT) 2017-09-14 13:48:45 +02:00
Olaoluwa Osuntokun a334025883
lnwire: swap order of MinAcceptDepth and HtlcMinimum
In this commit we reverse the ordering of the MinAcceptDepth and
HltcMinimum fields within the AcceptChannel message. Previously, the
order of these two fields were reversed, meaning the remote peer
would’ve attempted to parse the MinAcceptDepth (as we intended), as
part of the HtlcMinimum, leading to a garbage value.
2017-09-14 13:12:52 +02:00
Olaoluwa Osuntokun f01f83f938
build: update to latest build of neutrino to face race condition 2017-09-14 01:08:30 +02:00
Olaoluwa Osuntokun e5f3ee0fb6
chainntnfs+routing/chainview: reduce neutrino.WaitForMoreCFHeaders value
This commit reduces the neutrino.WaitForMoreCFHeaders parameter when
instantiating a neutrino instance as a lower value will allow the tests
to complete more quickly.
2017-09-13 16:46:11 +02:00
Olaoluwa Osuntokun 95b431ff3f
build: update glide to point to latest version of neutrino w/ bug fixes
This commit updates the glide build to point to the latest version of
neutrino which has a number of bug fixes related to re-org handling
with several hundred blocks, and also a number of fixes that should
eliminate the number of flakes within the ChainNotifier tests for the
neutrino back end.
2017-09-13 16:42:13 +02:00
Olaoluwa Osuntokun 737eeedd49
funding: don't send a funding error in the case of a funding timeout 2017-09-13 01:04:09 +02:00
Olaoluwa Osuntokun 3b2ed69638
funding: in failFundingFlow properly embed passed error 2017-09-12 22:38:44 +02:00
Olaoluwa Osuntokun 8a208ae3cd
server: disable bootstrapping for simnet mode by default 2017-09-12 22:13:52 +02:00
Olaoluwa Osuntokun bf071c1985
htlcswitch: properly verify OutgoingCTLV+Timeout when final hop in link
This commit fixes an existing bug in the way we perform validation of
the timelock information as the final hop in the route. Previously, we
would assert that the outgoing time lock in the per-hop payload would
exactly match our time lock delta.

Instead, we should be asserting two things:
   1. That the time lock in the payload is >= the expected time lock
   2. That timeout on the HTLC is exactly equal to the payload
2017-09-12 22:04:59 +02:00
Olaoluwa Osuntokun 246164e290
htlcswitch: when generating routes in test payload for last hop in absolute timeout 2017-09-12 21:32:07 +02:00
Olaoluwa Osuntokun b07e7fb7cc
routing: hop-payload for last hop should be the absolute timeout, not delta
This commit fixes an oversight in the path finding code when converting
a path into a route. Currently, for the last hop, we’d emplace the
expiry delta of the last hop within the per-hop payload. This was left
over from a prior version of the specification.

To fix this, we’ll now emplace the _absolute_ final HTLC expiry with
the payload, such that, the final hop that verify that the HTLC has not
been tampered with in flight.
2017-09-12 21:27:47 +02:00
Olaoluwa Osuntokun f32a7a28ab
htlcswitch: if we fail to parse and onion error, return the proper lnwire.FailCode 2017-09-12 18:10:40 +02:00
Olaoluwa Osuntokun 3d95efdc0f
htlcswitch: use %x when printing the payment hash of an HTLC
We use %x as it’ll hex-encode the raw bytes, instead of printing the
individual integers within the byte array.
2017-09-12 18:08:50 +02:00
Olaoluwa Osuntokun 769abb87ea
funding: properly verify and apply channel constraints during funding flow
This commit implements some missing functionality as we’ll now properly
validate and generate the various channel flow control constraints
during initial channel funding.

With this commit, we take an additional step towards full spec
compliance as we’ll now properly send over the required channel
reservation, max HTLC’s, and other parameters during the funding flow.

When processing the desired parameters by the remote party, if we think
they’re unreasonable, then we’ll send an Error message and end the
funding flow.
2017-09-12 18:07:50 +02:00