Rusty Russell
469faa476e
test_lightning.py: test for persistence.
...
Also note that failing an in-progress payment (instead of waiting) is
pretty weird.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Rusty Russell
6ba1bc5c93
channeld: repopulate HTLC shared secrets on reinitialization.
...
We could do this lazily, if HTLC errors out, but we do it as HTLCs
come in in the normal case, so this is slightly simpler.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Rusty Russell
02e05ba6ff
pay: remove struct pay_command.
...
It's all in wallet_payment, which is persistent.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Rusty Russell
ae1d72b978
wallet: add routine to delete a payment.
...
We do this instead of updating, if we've got an old failed one.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Rusty Russell
0f8f273410
lightningd: move cmd pointer from struct pay_command directly into htlc_out.
...
Set if a command is responsible.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Rusty Russell
559010f525
wallet: add path_secrets to payment table.
...
We need these to decode any returned errors.
We remove it from struct pay_command too, and load directly from db
when we need it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Rusty Russell
9b99b74c41
db: route to extract an array of struct secret from a column.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Rusty Russell
2cbe5b65c7
wallet: add preimage to db.
...
We should be saving this, as it's our proof of payment. Also, we return
it if they try to pay again.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Björge Dijkstra
d1b2a97146
Fix unitialized fields in htlc_out constructed from wallet database entry
2018-01-17 23:55:35 +01:00
Rusty Russell
3fbed24b0d
wallet: remove direction column from payments table.
...
We simply discard incoming entries.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 22:43:14 +01:00
Rusty Russell
dea0aef52f
wallet: use wallet_payment only for *outgoing* payments.
...
Incoming payment information is completely covered by invoices.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 22:43:14 +01:00
Eric Martindale
575b733edd
Fix paren in README, add autoconf
to dependencies
2018-01-17 16:22:44 +01:00
ZmnSCPxj, ZmnSCPxj jxPCSmnZ
be0b76f03d
INSTALL.md: Add automake
as dependency.
...
Fixes : #624
2018-01-17 16:17:32 +01:00
Filipe Farinha
b13c65dacb
withdraw: Swap 'satoshi' and 'destination' params to match online help.
2018-01-17 00:51:18 +01:00
windsok
710e91f255
update invoice manpage to match current RPC and CLI interface
2018-01-16 13:15:32 +01:00
ZmnSCPxj
93dc90990f
invoices: Extensive reorganization of invoice system.
2018-01-16 13:03:54 +01:00
Christian Decker
ad5eb1f7e1
pytest: Skip test_fee_limits for DEVELOPER=0
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-16 12:22:06 +01:00
Rusty Russell
79dc44713b
channeld: --ignore-fee-limits as a hack for fee disparities.
...
This, of course, should never be used. But it helps maintain connections
for the moment while we dig deeper into feerates.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-16 12:22:06 +01:00
practicalswift
e91a8dff12
Change log level for some common debug messages from "info" to "debug"
2018-01-16 03:20:27 +00:00
practicalswift
145e26371d
Add test for too-short decodepay (credit: @ZmnSCPxj)
2018-01-15 19:32:00 +00:00
practicalswift
a87c8a74b5
Avoid segfault on CLI command "decodepay 1111111" (invalid short bech32 string)
...
Before this patch:
```
$ cli/lightning-cli decodepay 1111111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 111111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 11111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 1111111
lightning-cli: Non-object response ''
$ cli/lightning-cli decodepay 1111111
lightning-cli: Connecting to 'lightning-rpc': Connection refused
```
After this patch:
```
$ cli/lightning-cli decodepay 1111111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 111111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 11111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 1111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 1111111
"Invalid bolt11: Bad bech32 string"
```
2018-01-15 19:32:00 +00:00
Christian Decker
5319ff1bc0
bitcoind: Do not crash when getblock fails
...
This is a common occurence on pruned nodes. By calling the callback
upon failures, we communicate that we couldn't verify the txoutput. We
fail safe rejecting any channel we can't verify.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-15 19:29:01 +00:00
Rusty Russell
4b663e596a
lightningd: don't crash when txout lookup fails.
...
Gossipd already correctly handles the "empty output means lookup failed" case.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-15 19:29:01 +00:00
Rusty Russell
c66df31674
subd: pass absolute path as argv[0].
...
This means we print out the correct path with --debugger, which
can be vital if there are multiple binaries (eg. compiled vs installed).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-15 19:26:08 +00:00
Rusty Russell
1950583612
subdaemon: make debugging a bit easier.
...
Use a volatile global, so debugger can flip it easily.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-15 19:26:08 +00:00
William Casarin
3e3dbfdd1b
hacking: document subdaemon debugging
...
Signed-off-by: William Casarin <jb55@jb55.com>
2018-01-15 19:26:08 +00:00
William Casarin
4a12cafe7f
debugging: add -ex return and cont to gdb command
...
Have gdb execute return and continue when attaching to a subdaemon
Signed-off-by: William Casarin <jb55@jb55.com>
2018-01-15 19:26:08 +00:00
Rusty Russell
fc151e10cd
test_lightning.py: check error on too-large funding tx.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-15 12:45:12 +01:00
Rusty Russell
904a3e4ae3
MAX_FUNDING_SATOSHI: clean up def to be max, fix name, share with openingd.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-15 12:45:12 +01:00
Christian Decker
351718e90f
jsonrpc: Return an error if funding amount is too large
...
Fixes #516
Reported-by: @instagibbs
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-15 12:45:12 +01:00
Rusty Russell
dbef4a1827
pay: remove gratuitous check for msatoshitok being 'null'.
...
json_get_params does this for us.
Fixes: 78adf0b
(pay: allow 'null' msatoshi field.)
Reported-by: ZmnSCPxj
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-15 12:44:02 +01:00
Christian Decker
dd599706cd
peer: Save whenever we change last_was_revoke as well
...
Pulling up the save call from `peer_save_commitsig_received` into its
caller `peer_got_commitsig` and adding a call to
`peer_sending_commitsig`
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-15 12:43:22 +01:00
Christian Decker
cc77012f63
wallet: Add last_was_revoke to channels
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-15 12:43:22 +01:00
William Casarin
44f9863192
permute_tx: bail on empty permute_{inputs/outputs} arguments
...
permute_outputs is sometimes called with empty arguments from initial_commit_tx.
Make sure we guard against that case. We also do the same in permute_inputs for
good measure.
Signed-off-by: William Casarin <jb55@jb55.com>
2018-01-15 06:35:02 +00:00
practicalswift
4214c5ad57
Use consistent formatting for CLI command descriptions
2018-01-15 04:20:30 +00:00
practicalswift
caf57b24ea
Use correct description for the "help" CLI command
2018-01-15 04:20:30 +00:00
Rusty Russell
4c45afafdc
channeld: handle ping instead of crashing when expecting reestablish.
...
Fixes : #592
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-15 04:18:44 +00:00
practicalswift
447afa923d
Avoid segfault on CLI command "dev-memleak" when $LIGHTNINGD_DEV_MEMLEAK is not set
2018-01-15 02:42:59 +00:00
Björge Dijkstra
44836ef509
Fix double free of message buffer.
...
Message buffer `why` is allocated in the `peer` context and also freed when peer is freed.
Only explicitly free the buffer when peer itself is not freed yet.
2018-01-15 02:12:10 +00:00
William Casarin
3c0d2813a0
bitcoind: properly handle spent outputs in gettxout
...
exit status is not enough to detect spent outputs. gettxout will return a
success exit code and 0 bytes.
Signed-off-by: William Casarin <jb55@jb55.com>
2018-01-14 23:49:59 +00:00
Christian Decker
f27013c338
gossip: Only skip updates if we don't have channels yet
2018-01-14 23:40:04 +00:00
Christian Decker
6f4fca3a6f
pytest: Verify that we forget nodes that have no channels anymore
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-14 23:40:04 +00:00
Christian Decker
8f16f6ca09
gossip: Forget nodes that have no associated channels anymore
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-14 23:40:04 +00:00
Christian Decker
3a42e52bcd
gossip: Fix a memcmp with unset memory in broadcast queue
...
`tal_fmt` overallocates the returned string under some circumstances,
meaning that the trailer of the formatted string is unset, but still
considered in `tal_len`. The solution then is to truncate the
formatted string to the real string length. Only necessary here, since
we mix strings and `tal_len`.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-14 23:40:04 +00:00
Christian Decker
4fe83cd405
pytest: Test for channel removal in test_gossip_pruning
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-14 23:40:04 +00:00
Christian Decker
ca6c6feaad
gossip: Remove channels older than 2*channel-update-interval
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-14 23:40:04 +00:00
Christian Decker
6e001d88c2
pytest: Add simple gossip pruning test
...
For now this just tests that we are sending out keepalive
channel_updates for all local channels.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-14 23:40:04 +00:00
Christian Decker
574dc8cd1f
gossip: Send keepalive channel_updates
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-14 23:40:04 +00:00
Christian Decker
4470612016
gossip: Network pruning loop every channel-update-interval/2 seconds
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-14 23:40:04 +00:00
Christian Decker
7fc8e3a4e2
gossip: Pass --channel-update-interval to gossipd
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-14 23:40:04 +00:00