Commit Graph

9 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
1b1e7a6168
channeldb: convert HTLCEntry to use tlv.RecordT 2024-08-28 13:21:46 +02:00
Elle Mouton
2c786ec66f
channeldb: add local and remote balance to revocation log
This commit re-adds the LocalBalance and RemoteBalance fields to the
RevocationLog. The channeldb/migration30 is also adjusted so that anyone
who has not yet run the optional migration will not lose these fields if
they run the migration after this commit.

The reason for re-adding these fields is that they are needed if we want
to reconstruct all the info of the lnwallet.BreachRetribution without
having access to the breach spend transaction. In most cases we would
have access to the spend tx since we would see it on-chain at which time
we would want to reconstruct the retribution info. However, for the
watchtower subsystem, we sometimes want to construct the retribution
info withouth having access to the spend transaction.

A user can use the `--no-rev-log-amt-data` flag to opt-out of storing
these amount fields.
2023-02-16 20:47:35 +02:00
Elle Mouton
0730337cc7
multi: add new NoRevLogAmtData config option
In this commit, a new `--db.no-rev-log-amt-data` flag is added. The
config option is passed though to everywhere that it will be used. Note
that it is still a no-op in this commit. An upcoming commit will make
use of the flag.
2023-02-16 20:47:29 +02:00
Elle Mouton
ce8e7ecfa7
channeldb: prepare RevocationLog for optional fields
This commit is a pure refactor. It restructures the RevocationLog
serialize and deserialize methods so that optional TLV fields can be
easily added.
2023-02-16 07:51:48 +02:00
Eng Zer Jun
c70e39cd21
multi: replace defer cleanup with t.Cleanup
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-10-13 17:46:54 +08:00
yyforyongyu
0e12a91715
channeldb: fix data race in TestSerializeHTLCEntries 2022-06-28 21:28:04 +08:00
yyforyongyu
2b5d535208
channeldb: fix data race in TestSerializeRevocationLog
When testing serializing revocation log, we need to also copy its
`HTLCEntries` as the serialization of the HTLC involves a writing to the
`htlc.amtTlv` field.
2022-06-01 02:20:44 +08:00
yyforyongyu
b288284566
channeldb: use BigSize to encode htlc amount
This commit uses bigsize record to encode the htlc amount, which could
save us 3 more bytes if the encoded value is no greater than roughly
0.043 bitcoin. The uint test has been updated with a more realistic
values to reflect the actual gain.
2022-04-20 01:19:40 +08:00
yyforyongyu
a129930a95
channeldb: add unit test for revocation log 2022-04-20 01:18:13 +08:00