Rusty Russell
9d9c1c3db6
wallet: wrap missing last_processed_block handling in COMPAT_V052.
...
Our testing also reveals a bug: we start lightningd and shut it down
before fully processing the blockchain, so we don't set
last_processed_block. Fix that by setting it immediately once we have
a block: worst case it goes backwards a little.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-07 18:55:51 +01:00
John Barboza
30b290cb8f
Explicit error message when disconnect fails
...
Whether the peer is not connected or not gossiping.
2018-03-07 16:14:01 +01:00
John Barboza
0a1351fd51
gossipd: command to disconnect from a gossiping peer
...
lightning-cli disconnect <peer id>
2018-03-07 16:14:01 +01:00
Christian Decker
aba3d5f34d
wallet: Clean up spent UTXOs once they are buried deeply enough
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-03-06 18:59:27 +01:00
Christian Decker
8958a082ec
wallet: Mark utxo outpoints as spent
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-03-06 18:59:27 +01:00
Christian Decker
50a8e32e3f
db: Add index on utxoset.spendheight to speed up blockchain reorgs
...
Otherwise we would be doing a table scan per block being reorged/rescanned.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-03-06 18:59:27 +01:00
Christian Decker
27e0ec694c
wallet: Add primitive to register new utxoset outpoint to the wallet
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-03-06 18:59:27 +01:00
Christian Decker
d8d11e5689
wallet: Add outpointfilter for the utxoset
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-03-06 18:59:27 +01:00
Christian Decker
ec014be2a8
db: Add utxoset table
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-03-06 18:59:27 +01:00
Christian Decker
5a1b4b91e2
wallet: Fix output extraction when we own multiple outputs
...
When we already know about an output we would stop scanning the remaining
outputs. Known outputs happen whenever we extracted from our own transactions
and then extracted again from blocks. We would not update if the first update
fails.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-03-06 18:59:27 +01:00
Christian Decker
ae30942e3f
chaintopo: Record outpoint spends for owned outputs
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-03-06 18:59:27 +01:00
Christian Decker
2680e6d9ff
wallet: Move txfilter into wallet
...
Transaction filters are strongly related to the wallet, this move just
makes it a bit more explicit.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-03-06 18:59:27 +01:00
Christian Decker
b3c94a5256
wallet: Update existing owned outputs with their confirmation height
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-03-06 18:59:27 +01:00
Christian Decker
7fc06d9b3e
wallet: Add outpointfilter to wallet so we can pass it all outputs
...
Will be used later to filter out outputs we are interested in, and
trigger db updates with them.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-03-06 18:59:27 +01:00
Christian Decker
247aa13a58
db: Add index covering the output heights
...
Avoids performing a table scan, now deletes on blocks are a lot
faster.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-03-06 18:59:27 +01:00
Christian Decker
4e2c1dd038
jsonrpc: Add confirmation status to listfunds
output
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-03-06 18:59:27 +01:00
Christian Decker
227dc36146
utxo: Add blockheight and spendheight to outputs to track state
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-03-06 18:59:27 +01:00
Christian Decker
7f00230657
db: Add confirmation_height and spend_height columns to outputs
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-03-06 18:59:27 +01:00
Christian Decker
9440b23852
wallet: Add primitive to roll back to a specific height
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-03-06 18:59:27 +01:00
Christian Decker
504202973f
wallet: Add primitives to store blockchain internally
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-03-06 18:59:27 +01:00
Christian Decker
fea03dbca9
db: Add a table to track blockheaders
...
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-03-06 18:59:27 +01:00
John Barboza
b50912d8b1
Print node alias when listing peers
2018-03-02 02:25:30 +00:00
Rusty Russell
c5d41a23d7
short_channel_id: just use structeq.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-01 23:33:56 +01:00
Igor Cota
cb6820d445
Do preimage, hash and consequentially bolt11 generation before we store the invoice in db.
...
This way we store bolt11 to the table as well, in case a client needs it later
2018-03-01 03:55:48 +00:00
Igor Cota
3371168d54
Add bolt11 to the invoice struct.
...
We store this in case an RPC client asks for it
2018-03-01 03:55:48 +00:00
Igor Cota
2bb9797ddb
Add bolt11 to the invoices db table as TEXT.
...
Saving in case an RPC client needs it later
2018-03-01 03:55:48 +00:00
ZmnSCPxj
efc5da9ad4
invoices: Use common code for loading r and rhash.
2018-02-28 11:17:08 +01:00
ZmnSCPxj
978e5c67d8
invoices: Remove persistent in-memory invoice structures.
2018-02-28 11:17:08 +01:00
ZmnSCPxj
f05c86618c
invoices: Change iteration interface to be more abstract.
2018-02-28 11:17:08 +01:00
ZmnSCPxj
e9112af0bc
invoices: Move expiration timer to invoices object.
...
In preparation for removing in-memory invoices objects.
2018-02-28 11:17:08 +01:00
ZmnSCPxj
7a6fe0704e
invoices: Unify waitone/any waiters to invoices object.
...
In preparation for removing in-memory invoice objects.
Since they will be removed, there will no longer be any
individual invoice objects to attach to.
2018-02-28 11:17:08 +01:00
ZmnSCPxj
9b4c6699f9
invoices: Semantically separate invoice details from invoice.
...
In preparation for removing in-memory invoice structures.
Invoice details are requested rarely anyway.
2018-02-28 11:17:08 +01:00
Rusty Russell
b7ed5670d5
lightningd: close and reopen db across fork for daemonize
...
Fixes : #1092
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-27 00:09:34 +01:00
ZmnSCPxj
f7f55edcdb
wireaddr: Do hostname resolution in parse_wireaddr.
...
Fixes : #834
2018-02-26 03:13:55 +00:00
ZmnSCPxj
bd07a91782
jsonrpc: Let Base58 '2..' address work on both regtest and testnet.
2018-02-26 03:09:15 +00:00
John Barboza
b028a0a439
invoice: add fallback address to invoice command
...
* Modifies invoice command to have the following format
invoice <msatoshi> <label> <desc> <?expiry> <?fallbackaddr>
* Adds support for Segwit bcrt1 addresses for withdraw
* Add test case for fallback address in invoice creation
* Create a common json_tok_address_scriptpubkey to be used
by invoice and withdraw commands.
2018-02-26 03:09:15 +00:00
Christian Decker
7c8883ae7d
wallet: Fix an off by one error in dev-listaddrs
...
Reported-By: @Xian001
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-23 21:53:40 +00:00
Rusty Russell
cccdb53bec
channel_states: fold all the ONCHAIND states into one.
...
The billboard is now far more useful to tell what's going on, and this
gets us closer to a state == owner mapping.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-23 18:02:00 +01:00
Rusty Russell
86a04c59d4
lightningd: maintain a status billboard for each channel.
...
Each state (effectively, each daemon) has two slots: a permanent slot
if something permanent happens (usually, a failure), and a transient
slot which summarizes what's happening right now.
Uncommitted channels only have a transient slot, by their very nature.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-23 18:02:00 +01:00
Rusty Russell
655ae90e5e
wallet: remove obsolete peers.
...
Fixes : #1029
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-22 12:06:39 +01:00
practicalswift
d873bf60bf
Remove unused parameter fieldname in json_add_log(..., const char *fieldname, ...)
2018-02-22 10:46:30 +01:00
practicalswift
7be95cee94
Remove unused parameter ctx in wallet_peer_load(const tal_t *ctx, ...)
2018-02-22 10:46:30 +01:00
practicalswift
1f46262278
Remove unused parameter testname in create_test_db(const char *testname)
2018-02-22 10:46:30 +01:00
practicalswift
91a9c2923f
Mark intentionally unused parameters as such (with "UNUSED")
2018-02-22 01:09:12 +00:00
Rusty Russell
e92b710406
tools/generate-wire.py: remove length argument from fromwire_ routines.
...
We always hand in "NULL" (which means use tal_len on the msg), except
for two places which do that manually for no good reason.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-20 22:36:21 +01:00
Rusty Russell
719290a4c4
txwatch: remove unused callback arg, hide struct definitions.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-20 22:36:21 +01:00
Rusty Russell
ae8fb96d06
lightningd/channel_control: routines to control channeld (move from peer_control.c)
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-20 22:36:21 +01:00
Rusty Russell
372040bbd5
lightningd/onchain_control: routines to control onchaind (move from peer_control.c)
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-20 22:36:21 +01:00
Rusty Russell
9176ee628c
lightningd/closing_control: routines to control closingd (move from peer_control.c)
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-20 22:36:21 +01:00
Rusty Russell
a83ff83328
lightningd/connect_control: routines to control connecting (move from peer_control.c)
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-20 22:36:21 +01:00