INNER CODE UNIT · Go

minOnionErrorLength

lightningnetwork/lightning-onion · crypto.go:317

const minOnionErrorLength = 2 + 2 + 256 + sha256.Size

// DecryptError attempts to decrypt the passed encrypted error response. The
// onion failure is encrypted in backward manner, starting from the node where
// error have occurred. As a result, in order to decrypt the error we need get
// all shared secret and apply decryption in the reverse order. A structure is
// returned that contains the decrypted error message and information on the
// sender.
func (o *OnionErrorDecrypter) DecryptError(encryptedData []byte) (
	*DecryptedError, error) {

	// Ensure the error message length is as expected.
	if len(encryptedData) < minOnionErrorLength {
		return nil, fmt.Errorf("invalid error length: "+
			"expected at least %v got %v", minOnionErrorLength,
			len(encryptedData))
	}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…