watchtower: convert JusticeKit to interface
In this commit, we convert the `JusticeKit` struct to an interface. Then, we add two implementations of that interface: 1) The `legacyJusticeKit` which implements all the methods of `JusticeKit` 2) The `anchorJusticKit` which wraps the `legacyJusticeKit` and just re-implements the `ToRemoteOutputSpendInfo` method since.
This commit is contained in:
14 files changed
+666
-520
No files matched your search
@@ -240,9 +240,19 @@ func (t *TowerDB) InsertStateUpdate(update *SessionStateUpdate) (uint16, error)
|
||||
return err
|
||||
}
|
||||
|
||||
commitType, err := session.Policy.BlobType.CommitmentType(nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
kit, err := commitType.EmptyJusticeKit()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Assert that the blob is the correct size for the session's
|
||||
// blob type.
|
||||
expBlobSize := blob.Size(session.Policy.BlobType)
|
||||
expBlobSize := blob.Size(kit)
|
||||
if len(update.EncryptedBlob) != expBlobSize {
|
||||
return ErrInvalidBlobSize
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user