mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
db: Create table for HTLCs
Also added a small warning to one of the used enums not to reorder or insert values. They'd break the update path. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
a4967d74f1
commit
3dda72c885
@ -2,6 +2,10 @@
|
||||
#define LIGHTNING_COMMON_HTLC_STATE_H
|
||||
#include "config.h"
|
||||
|
||||
/*
|
||||
* /!\ The generated enum values are used in the database, DO NOT
|
||||
* reorder or insert new values (appending at the end is ok) /!\
|
||||
*/
|
||||
enum htlc_state {
|
||||
/* When we add a new htlc, it goes in this order. */
|
||||
SENT_ADD_HTLC,
|
||||
|
19
wallet/db.c
19
wallet/db.c
@ -92,6 +92,25 @@ char *dbmigrations[] = {
|
||||
" max_accepted_htlcs INTEGER,"
|
||||
" PRIMARY KEY (id)"
|
||||
");",
|
||||
"CREATE TABLE channel_htlcs ("
|
||||
" id INTEGER,"
|
||||
" channel_id INTEGER REFERENCES channels(id) ON DELETE CASCADE,"
|
||||
" channel_htlc_id INTEGER,"
|
||||
" direction INTEGER,"
|
||||
" origin_htlc INTEGER,"
|
||||
" msatoshi INTEGER,"
|
||||
" ctlv_expiry INTEGER,"
|
||||
" payment_hash BLOB,"
|
||||
" payment_key BLOB,"
|
||||
" routing_onion BLOB,"
|
||||
" failuremsg BLOB,"
|
||||
" malformed_onion INTEGER,"
|
||||
" hstate INTEGER,"
|
||||
" shared_secret BLOB,"
|
||||
" preimage BLOB,"
|
||||
" PRIMARY KEY (id),"
|
||||
" UNIQUE (channel_id, channel_htlc_id, direction)"
|
||||
");",
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user