channeldb: re-introduce revocationLogBucket

This commit adds `revocationLogBucket` using the new sub-bucket key
"revocation-log" to store the minimal info needed. Two structs,
`RevocationLog` and `HTLCEntry` are created to represent the disk
records.
This commit is contained in:
yyforyongyu
2022-04-07 05:48:57 +08:00
parent 4609ac2008
commit c41175f233
2 changed files with 373 additions and 4 deletions

View File

@@ -179,10 +179,6 @@ var (
// channel.
ErrChanBorked = fmt.Errorf("cannot mutate borked channel")
// ErrLogEntryNotFound is returned when we cannot find a log entry at
// the height requested in the revocation log.
ErrLogEntryNotFound = fmt.Errorf("log entry not found")
// ErrMissingIndexEntry is returned when a caller attempts to close a
// channel and the outpoint is missing from the index.
ErrMissingIndexEntry = fmt.Errorf("missing outpoint from index")
@@ -1687,6 +1683,8 @@ func (c *OpenChannel) ActiveHtlcs() []HTLC {
//
// TODO(roasbeef): save space by using smaller ints at tail end?
type HTLC struct {
// TODO(yy): can embed an HTLCEntry here.
// Signature is the signature for the second level covenant transaction
// for this HTLC. The second level transaction is a timeout tx in the
// case that this is an outgoing HTLC, and a success tx in the case