Commit Graph

241 Commits

Author SHA1 Message Date
Rusty Russell e66bd25b5c test_lightningd.py: test lockin while we're not running.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-25 12:52:06 +01:00
Christian Decker 7b0d806d71 pytest: Check that we forget irrevocably settled channels
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-25 00:14:23 +00:00
Rusty Russell f03dbde354 test_lightningd.py: Test 0-msatoshi pay
Based-on-patch-by: ZmnSCPxj <ZmnSCPxj@protonmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-24 19:34:46 +01:00
practicalswift 96d093fb30 Fix typos 2018-01-24 17:29:40 +01:00
Christian Decker ee850f38d6 pytest: Fix test_fee_limits
This was flaky because we didn't wait for the fee update to complete
and were using the old, way too small, fees, which upset bitcoind.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-19 22:26:58 +00:00
Rusty Russell 8797159825 Use consistent names for timestamps.
Old fields still there, just deprecated.

Invoice commands:
	paid_timestamp -> paid_at
	expiry_time -> expires_at

decodepay:
	timestamp -> created_at

getlog:
	creation_time -> created_at

listpayments:
	timestamp -> created_at

Suggested-by: @shesek
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell 4f1dc91ba5 lightningd: rename --deprecated-apis to --allow-deprecated-apis.
Suggested-byL practicalswift
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Christian Decker 0c9d29065c pytest: Remove some debug print statements 2018-01-19 22:23:45 +00:00
Christian Decker b8b4998f7a pytest: Temporarily disable alias and color checking for DEVELOPER=0
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-19 22:23:45 +00:00
Rusty Russell 5e0a5c9111 JSONRPC: delinvoice: have a status argument.
delinvoice was orginally documented to only allow deletion of unpaid
invoices, but there might be reasons to delete paid ones or unexpired ones.

But we have to avoid the race where someone pays as it's deleted: the
easiest way is to have the caller tell us the status, and fail if
it's wrong.

Fixes: #477
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell c8c68cfb7c JSONRPC: listpeers multiple channels, output improvements.
We're going to have to support multiple channels per peer, even if only
when some are onchain.  This would break the current listpeers, so
change it to an array (single element for now).

Other cleanups:

1. Only set connected true if daemon is not onchaind.
2. Only show netaddr if connected; don't make it an array, call it `address`
   in comparison with `addresses` in listnodes.
3. Rename `channel` to `short_channel_id`
4. Add `funding_txid` field for voyeurism.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell 78672738ff test_lightningd.py: remove deprecated APIs.
Individual tests can always re-enable them, though.

[ More test fallout fixes by Christian Decker ]
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell bd010d4b96 listinvoices: deprecate 'complete' in favor of 'status' trinary.
[ Manpage regen fixup by Christian Decker ]
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell 67b7362986 test_lightningd.py: switch to listinvoices instead of listinvoice.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell 962514c3a0 addfunds: remove.
We now detect funds, so this is just confusing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell 2f2cacef0d JSONRPC: output from listpeers should be 'id' not 'peerid'.
That's what we use everywhere else.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell 5698a133c2 JSONRPC: rename getpeers to listpeers.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell 34a994c7db JSONRPC: listpayments not return a naked array.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell 6e703ad977 JSONRPC: listpayments can list just a specific bolt11 or payment_hash.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell 06c4f6ddca JSONRPC: add optional short_channel_id argument to listchannels
In order to just list one (though it may return two entries, one for each
channel direction!).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell 7fdb30cbda JSONRPC: rename getchannels to listchannels
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell e1e7f289fb JSONRPC listnodes: return timestamp, alias and color.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell ced572b973 JSONRPC: getnodes: rename to listnodes.
Like listinvoice, and add optional 'id' parameter to ask about a
specific node.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
practicalswift aefc887521 Fix typos 2018-01-18 20:50:07 +01:00
ZmnSCPxj a88c73a41b invoices: Add `paid_timestamp` field.
Fixes: #615
2018-01-18 17:37:10 +01:00
Rusty Russell 15aaf9f49a test_lightning.py: shutdown tail thread before killing.
Seems to avoid the nasty python resource warnings, as well as the
fatal 'ValueError: PyMemoryView_FromBuffer(): info->buf must not be NULL'

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Rusty Russell 4b178621e2 test_lightningd.py: test that payments are pending even before HTLC committed.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
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
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 145e26371d Add test for too-short decodepay (credit: @ZmnSCPxj) 2018-01-15 19:32:00 +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
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 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 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
Rusty Russell a1a0b33577 pay: allow 'null' msatoshi field.
Since most callers use positional arguments, we should allow a 'null'
literal where we require no value at all.

Also adds some more value tests.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-14 23:10:10 +00:00
Rusty Russell 2f2fb0c2a1 invoice: add msatoshi_received field.
Paid invoices need to know how much was actually paid: both for the case
where no 'msatoshi' amount was specified, and for the normal case, where
clients are permitted to overpay in order to help them disguise their
payments.

While we migrate the db, we leave this field as 0 for old paid
invoices.  This is unhelpful for accounting, but at least clearly
indicates what happened if we find this in the wild.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-14 23:10:10 +00:00
Rusty Russell 66885163c9 JSON: Rename rhash to payment_hash in delinvoice, invoice, listinvoice, waitinvoice, waitanyinvoice.
'rhash' is the old terminology, but 'payment_preimage' and
'payment_hash' were decided on for the BOLTs, so we should fix that here.

We still use rhash internally, but that's much easier to fix.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-14 23:10:10 +00:00
Rusty Russell 7c5dec01fe test_lightning.py: use wait_for_routes() helper more widely.
It uses the correct method to avoid races, so use it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-13 00:40:10 +01:00
Rusty Russell 6cea8d2e5b test_lightning.py: test_onchain_middleman must wait for route propagation
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-13 00:40:10 +01:00
Rusty Russell 6a1ea14441 test_lightningd.py: make sure l2 has seen announcements in test_gossip_jsonrpc
>       assert [c['active'] for c in l2.rpc.getchannels()['channels']] == [True, True]
E       AssertionError: assert [False, True] == [True, True]
E         At index 0 diff: False != True
E         Full diff:
E         - [False, True]
E         + [True, True]

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-13 00:40:10 +01:00
Rusty Russell 6b7b7f1007 test_lightningd.py: fix timing error in test_forward_different_fees_and_cltv
We need to make sure all the updates are known to gossip.  Since
one is the local update, we change that message to look the same.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-12 09:46:56 +01:00
Rusty Russell d84dc5633a test_lightning.py: make sure gossip has processed channel_updates.
Receiving them in channeld is not enough to avoid the race:

    route = l1.rpc.getroute(l3.info['id'], 4999999, 1)["route"]
...
    ValueError: RPC call failed: Could not find a route

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-12 09:46:56 +01:00
Rusty Russell 896ecb4da7 test_lightning: don't fire prematurely on test_gossip_jsonrpc.
We wait the the receipt of the CHANNEL_UPDATE message by channeld,
but that doesn't mean it reached gossipd yet, causing spurious test
failure.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-12 09:46:56 +01:00
Rusty Russell a4dd523c8b test_lightning.py: fix ambigious log order in test_reconnect_signed.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-12 09:46:56 +01:00
Igor Cota e97857847a peer_control: make hardcoded feerates consistent between json_fund_channel and peer_offer_channel
Stops some transactions from failing on the other side due to insufficient funds.
2018-01-12 03:40:31 +00:00
ZmnSCPxj 5f8796af0c test_lightningd.py: Add tests for any-amount invoices. 2018-01-12 01:43:55 +00:00
Rusty Russell bc4f2da50a test_lightning.py: make sure reconnect doesn't leave multiple peers.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-11 23:47:47 +01:00
Rusty Russell 43c97187a4 test_lightningd: fix test_gossip_jsonrpc.
A watch constant never changes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-11 23:13:23 +01:00
Rusty Russell 7e0bc88e2a gossip: fix default broadcast interval, move option.
This now makes a few more gossip tests time out without --dev-broadcast-interval

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-11 21:39:13 +01:00