Commit Graph

34 Commits

Author SHA1 Message Date
Conner Fromknecht
3be651b0b3
watchtower/wtdb: add ClientDB
This commit adds the full bbolt-backed client database as well as a set
of unit tests to assert that it exactly implements the same behavior as
the mock ClientDB.
2019-05-24 18:24:41 -07:00
Conner Fromknecht
b35a5b8892
watchtower/wtclient: integrate ClientChannelSummaries
In this commit, we utilize the more generic ClientChanSummary instead of
exposing methods that only allow us to set and fetch sweep pkscripts.
2019-05-23 20:48:50 -07:00
Conner Fromknecht
25fc464a6e
watchtower/wtdb/client_chan_summary: add ClientChanSummary
A ClientChanSummary will be inserted for each channel registered with
the client, which for now will just track the sweep pkscript to use. In
the future, this will be extended with additional information to enable
the client to efficiently compute which historical states need to be
backed up under a given policy.
2019-05-23 20:48:36 -07:00
Conner Fromknecht
440ae7818a
watchtower/wtmock/client_db: adjust mock clientdb behavior
In advance of the upcoming wtdb.ClientDB, we'll modify the behavior
of the mockdb to be more like the final bbolt backed one, and assert
that all or our tests are still passing.
2019-05-23 20:48:23 -07:00
Conner Fromknecht
2a904cb69f
watchtower/wtdb: add Encode/Decode methods to wtclient structs 2019-05-23 20:48:08 -07:00
Conner Fromknecht
1db9bf2fd4
watchtower/wtdb: create embedded ClientSessionBody
This commit splits out the portions of the ClientSession into an
embedded ClientSessionBody, since these fields will be serialized
together on-disk.
2019-05-23 20:47:49 -07:00
Conner Fromknecht
5ad9530502
watchtower/wtdb: return sorted ClientSession.CommittedUpdates
This commit replaces the map-based CommittedUpdates field with a slice.
When reading from disk, these will already be sorted by bbolt, so the
client restore the updates as presented without needing to sort them
first.

Since the key in the map variant was the sequence number, we refactor
the CommittedUpdate struct to have a sequence number and an embedded
CommittedUpdateBody (which is equivalent to the old CommittedUpdate).
The database is then expected to populate the sequence number from the
key on disk.

Since the sequence number is now directly integrated in the
CommittedUpdate struct, this allow allows us to remove the now redundant
seqNum argument from CommitUpdate.
2019-05-23 20:47:36 -07:00
Conner Fromknecht
3509c0c991
watchtower/multi: use proper TowerID type
This allows serialization methods to be added with TowerID method
receivers.
2019-05-23 20:47:22 -07:00
Conner Fromknecht
ec7c16fdc1
watchtower/wtdb: prepare for addition of client db
This commit renames the variables dbName to towerDBName and dbVersions
to towerDBVersions, to distinguish between the upcoming clientDBName
clientDBVersions. We also move resusable portions of the database
initialization and default endianness to its own file so that it can be
shared between both tower and client databases.
2019-05-23 20:47:08 -07:00
Conner Fromknecht
17b2140cb5
multi: fix spelling mistakes 2019-05-04 15:35:37 -07:00
Conner Fromknecht
b7cd70f186
watchtower/wtdb/tower_db_test: add mock+bolt iface tests 2019-04-26 17:21:48 -07:00
Conner Fromknecht
3ef2a36733
watchtower/wtdb/tower_db: add TowerDB and db versioning 2019-04-26 17:21:35 -07:00
Conner Fromknecht
c99d1313fe
watchtower/wtdb/log: add WTDB logs 2019-04-26 17:21:20 -07:00
Conner Fromknecht
a36397e21a
watchtower/wtdb/codec_test: encode/decode quick checks 2019-04-26 17:21:05 -07:00
Conner Fromknecht
7ba197c6a7
watchtower/wtdb: add encode/decode to session info + updates 2019-04-26 17:20:52 -07:00
Conner Fromknecht
dccef4c8bf
watchtower/wtdb/codec: import channeldb code for extension 2019-04-26 17:20:36 -07:00
Conner Fromknecht
2ce6228021
watchtower/wtmock/tower_db: move mock tower db to wtmock pkg 2019-04-26 17:19:58 -07:00
Conner Fromknecht
ec6e2010d6
watchtower/wtmock: validate key index reservation 2019-04-23 20:06:20 -07:00
Conner Fromknecht
978a0a8de6
watchtower/wtserver/server: permit unused session overrwite 2019-04-23 20:06:04 -07:00
Conner Fromknecht
c6f95c5667
watchtower/wtdb/client_session: replace keydesc w/ KeyIndex 2019-04-23 20:04:06 -07:00
Conner Fromknecht
7d99005dde
watchtower/wtclient/interface: add LoadTower and mock impl 2019-04-23 19:17:21 -07:00
Conner Fromknecht
8e4a20e1a5
watchtower/wtserver/interface: add DeleteSession + mock impl 2019-03-19 19:38:34 -07:00
Conner Fromknecht
8b0cc487f0
watchtower/wtdb+wtserver: allow retransmission of last update 2019-03-15 02:33:06 -07:00
Conner Fromknecht
9177358a3c
watchtower/wtdb/client_session: add ClientSession 2019-03-15 02:30:22 -07:00
Conner Fromknecht
247978dfe2
watchtower/wtdb/tower: store wt pk and addrs 2019-03-15 02:30:09 -07:00
Conner Fromknecht
09e71a1d49
watchtower/multi: use ComputeJusticeTxOuts, test altruist+reward 2019-02-01 17:30:13 -08:00
Conner Fromknecht
b746bf86c2
watchtower/multi: switch over to wtpolicy
migrate to using wtpolicy.Policy in wtwire messages and wtserver
2019-01-10 15:59:54 -08:00
Conner Fromknecht
b79bab0920
watchtower/wtdb/mock: adds lookout-related mock functions 2018-10-31 20:42:06 -07:00
Conner Fromknecht
4e6dc3863b
watchtower/wtdb/session_info: compute rewards outputs 2018-10-31 20:42:04 -07:00
Conner Fromknecht
fd6024c306
watchtower/wtdb/mock: adds MockDB for debug build 2018-10-24 20:18:21 -07:00
Conner Fromknecht
8b47a96459
watchtower/wtdb/session_state_update: adds session state 2018-10-24 20:18:21 -07:00
Conner Fromknecht
405838d29c
watchtower/wtdb/session_info: adds SessionInfo 2018-10-24 20:18:21 -07:00
Conner Fromknecht
e825a756f4
watchtower/wtdb/session_id: adds SessoinID, client pubkey 2018-10-24 20:18:21 -07:00
Conner Fromknecht
bc86ccf212
watchtower/wtdb/breach_hint: adds BreachHint, txid prefix 2018-10-24 20:18:17 -07:00