lnwire: all hashes within the protocol are now 32-bytes

We now enforce that the site of all revocation pre-images+hashes (used
for HTLC’s) are now 32-bytes.

Additionally, all payment pre-images are now required to be 32-bytes
not he wire. There also exists a Script level enforcement of the
payment pre-image size at a lower level.

This commit serves to unify the sizes of all hashes/pre-images across
the codebase.
This commit is contained in:
Olaoluwa Osuntokun
2016-06-30 11:53:11 -07:00
parent fd02c1c1aa
commit bba9b665ef
10 changed files with 29 additions and 23 deletions

View File

@@ -45,7 +45,7 @@ type HTLCAddRequest struct {
// number of pre-images for each of the listed hashes. For regular HTLC's
// this slice only has one hash. However, for "multi-sig" HTLC's, the
// length of this slice should be N.
RedemptionHashes [][20]byte
RedemptionHashes [][32]byte
// OnionBlob is the raw serialized mix header used to route an HTLC in
// a privacy-preserving manner. The mix header is defined currently to
@@ -78,7 +78,7 @@ func (c *HTLCAddRequest) Decode(r io.Reader, pver uint32) error {
// Expiry(4)
// Amount(4)
// ContractType(1)
// RedemptionHashes (numOfHashes * 20 + numOfHashes)
// RedemptionHashes (numOfHashes * 32 + numOfHashes)
// OnionBlog
err := readElements(r,
&c.ChannelPoint,