Commit Graph

961 Commits

Author SHA1 Message Date
Rusty Russell de2ffd8985 accept_pkt_open_commit_sig: don't allocate sig.
Caller can allocate and free; this gets the context correct (that
commit).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-04 11:17:04 +10:30
Rusty Russell ac7d80bbeb peer: don't assign io_data and id twice when connecting out.
peer_first_connected does this.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-04 11:17:04 +10:30
Rusty Russell 8a1559a343 peer: free init packet.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-04 11:17:04 +10:30
Rusty Russell 6bda93f99a peer: don't leave initial cstate around.
Attach it to the commit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-04 11:17:04 +10:30
Rusty Russell 64809fb730 peer: free temporary transaction immediately
Don't leave it around until connect is finished.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-04 11:17:03 +10:30
Rusty Russell 8015ceadfd log: add netaddr
Also avoids allocating netaddr_name which otherwise lasts as long
as connection does.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-04 11:17:03 +10:30
Rusty Russell 4c7017f607 dns: simplify code by reaping dns child as soon as we have answers.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-04 11:17:03 +10:30
Rusty Russell 78a0177f1c script: free redeemscript in bitcoin_witness_p2sh_p2wpkh
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-04 11:17:03 +10:30
Rusty Russell e0368cc82d cryptopkt: don't leak negotiation state.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-04 11:17:03 +10:30
Rusty Russell 319eef266d commit_tx: free temporary wscript, rather than leaving attached to tx.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-04 11:17:03 +10:30
Rusty Russell b768de324c commit_tx: plug leak.
Use a tmpctx, and clean up afterwards.  Steal the script onto the tx,
however.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-04 11:16:14 +10:30
Rusty Russell 1d57fa60b8 invoice: print duplicate r value even if we choose it.
This shouldn't happen, but if our RNG is busted and get a duplicate,
r would be NULL.

(scan-build found this)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-01 21:34:58 +10:30
Rusty Russell 642a2f2d4e cryptopkt: free output packets after encryption.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-01 21:34:58 +10:30
Rusty Russell 95a01670ac cryptopkt: free incoming packet after decryption.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-01 21:34:57 +10:30
Rusty Russell 5f32d291bf jsonrpc: free old connections
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-01 21:34:57 +10:30
Rusty Russell a4ee683b3e tal_tmpctx: clear marker for temporary contexts.
This makes them stand out in memory dumps.  Also plug two existing
memory leaks.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-01 21:34:27 +10:30
Rusty Russell c1d6df58aa feechange: fix db updates.
Found by PVS Studio.

Reported-by: Jon Griffiths <jgriffiths@blockstream.io>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-01 21:33:27 +10:30
Rusty Russell fa402aac31 routing: fix hash of pubkeys.
Found by PVS Studio.

Reported-by: Jon Griffiths <jgriffiths@blockstream.io>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-01 21:33:06 +10:30
Rusty Russell 48da22ab4b Merge remote-tracking branch 'origin/pr/56'
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-25 11:23:34 +10:30
Rusty Russell dfad49bbd7 Merge remote-tracking branch 'origin/pr/55'
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-25 11:19:15 +10:30
Rusty Russell 60e7e54f95 Merge remote-tracking branch 'origin/pr/53'
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-25 11:16:52 +10:30
Christian Decker 3dd2e0c2b3 jsonrpc: Correctly handle numeric invoice labels
`listinvoice` was not handling numeric labels correctly if they are not
passed in as JSON strings (which was the behavior of
`lightning-cli`). So now we accept both string labels as well as numeric
labels.
2016-10-23 18:52:08 +02:00
Christian Decker de187ecaf7 jsonrpc: Accomodate some pedantic JSON-RPC impls
The JSON-RPC was non-standard compliant in that it omitted the required
`jsonrpc` entry and it was returning both `error` as well as
`result`. This fixes both of these issues.
2016-10-23 16:19:08 +02:00
Christian Decker a97d301155 routing: Refuse self-route
Fixes #50. Was causing a segfault because it was creating an empty route
and was trying to extract the first hop as next hop. Routes through self
can still be created manually, but `sendpay` would still refuse to act
on them due to the missing self-link.
2016-10-23 11:57:50 +02:00
Christian Decker 50807db7aa jsonrpc: Fixed `listinvoice` returning broken JSON
Closes #48.
2016-10-23 10:57:29 +02:00
Rusty Russell 144c40afd0 irc: get much less chatty.
We're going to wean off IRC, but as a quick fix, only announce 0-60 seconds
after we see a join, or every 6 hours.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-21 12:05:33 +10:30
Rusty Russell 6da448b797 0.5: Bitcoin Savings & Trust Daily Interest
Glenn Willen filed plenty of bug reports; he got to name this release.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-19 12:12:26 +10:30
Rusty Russell 0713de1db1 README.md: User instructions.
Just in case we get any.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-19 12:09:19 +10:30
Rusty Russell 1b6012879b contrib/lightning-pay: helper to make a payment.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-19 12:02:27 +10:30
Rusty Russell 76ac978df4 contrib/lightning-open-channel: helper to open a channel.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-19 12:01:27 +10:30
Rusty Russell 7d20c4f75b feechange: disable sending of feechange messages.
We've seen intermittant failures on testnet, so disable sending feechanges
for now: we're completely changing it for 0.6 anyway, due to Milan Spec.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-19 12:00:27 +10:30
Rusty Russell af9ee44d52 sphinx: memset warning suppression workaround.
Milan summit finalized some changes, so this will be reworked
soon anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-17 12:44:09 +10:30
Rusty Russell 02cb651748 Merge remote-tracking branch 'origin/pr/46'
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-17 12:37:20 +10:30
Rusty Russell d47d19ef2b Merge remote-tracking branch 'origin/pr/44'
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-17 12:31:19 +10:30
Rusty Russell a9df84145e Merge remote-tracking branch 'origin/pr/43'
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-17 12:20:03 +10:30
Rusty Russell eaef85c0fb Merge remote-tracking branch 'origin/pr/42'
Add note that you now only need asciidoc if you change manpages.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-17 12:15:36 +10:30
Christian Decker d30f3f1a40 sphinx: Remove obsolete onion implementation 2016-10-16 16:40:54 +02:00
Christian Decker 1d3737055a sphinx: Integrate sphinx OR with lightningd
Now replaces the old cleartext onion routing with the sphinx
implementation.
2016-10-16 16:40:50 +02:00
Christian Decker 7bb5c279a8 sphinx: Implemented sphinx onion routing
Implements a spec-compliant sphinx onion routing format. The format has
been cross-checked with the go implementation
cdecker/lightning-onion@b9e117e.
2016-10-16 16:40:43 +02:00
Rusty Russell 5797dc6496 init: add comments as per updated BOLT #2.
To match 8ad8041990dc "wire-protocol: rename reconnect_pkt to
init_pkt, add feature bits."

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-07 17:40:04 +10:30
Rusty Russell 5e078a8167 pkt_init: check feature bits.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-07 17:39:55 +10:30
Rusty Russell ec64e7756e protocol: pkt_reconnect becomes pkt_init, and always send.
Make this always the first packet after auth.  That means there's no
reliance on whether a node remembers an aborted connection.

It also gives us a place to put version bits.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-07 17:39:34 +10:30
Rusty Russell e5994ad8c1 json_connect: don't return until we're in state normal.
This gives much better errors, and allows us to return the peer id.

Closes: #37
Reported-by: Glenn Willen
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-07 14:01:18 +10:30
Rusty Russell d1c30c45ab getinfo: show block height.
My lightning node was *way* behind, and I couldn't figure out why it
wasn't seeing channel establishment.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-07 14:01:18 +10:30
Rusty Russell f66358882a config: different defaults for mainnet and testnet.
In particular, remove fee ranges on testnet (too unreliable) and accept
a single confirm.

(Note that an earlier version of this had a bug when there was no
config file, this version includes the fix).

Closes: #40
Reported-by: Glenn Willen
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-07 14:00:18 +10:30
Rusty Russell c0d0606d66 lightningd: move testnet flag out of config.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-07 14:00:18 +10:30
Rusty Russell 1e6f7059d3 lightningd: allow --commit-fee-max=0 for "no limit"
For testnet, fee estimates are not reliable at all.

Reported-by: Christian Decker
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-07 14:00:17 +10:30
Rusty Russell 44282eed16 test.sh: increase timeout, slow down bitcoind polling.
My temporary machine is incredibly slow.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-07 14:00:17 +10:30
Rusty Russell a1f1f1eda8 daemon: fix feechange logic.
Firstly, we need to update the staging fee amount when we queue a change.
Secondly we need to remove completed fee updates, otherwise we hit a
database constraint that peer & state are unique.

Reported-by: Christian Decker
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-07 14:00:17 +10:30
Rusty Russell e2090f015d peer: don't spin when we want to commit and are not connected.
Instead, stop timer loop, and restart when we connect again.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-10-07 14:00:17 +10:30