lnwire: allow up to 35-bytes in pkScripts to account for P2WSH

This commit is contained in:
Olaoluwa Osuntokun
2017-04-19 16:04:38 -07:00
parent 8081fab8fe
commit 9324a503c9
4 changed files with 10 additions and 22 deletions

View File

@@ -169,9 +169,10 @@ func writeElement(w io.Writer, element interface{}) error {
return err
}
case PkScript:
// Make sure it's P2PKH or P2SH size or less.
// The largest script we'll accept is a p2wsh which is exactly
// 34 bytes long.
scriptLength := len(e)
if scriptLength > 25 {
if scriptLength > 34 {
return fmt.Errorf("'PkScript' too long")
}
@@ -425,7 +426,7 @@ func readElement(r io.Reader, element interface{}) error {
return err
}
case *PkScript:
pkScript, err := wire.ReadVarBytes(r, 0, 25, "pkscript")
pkScript, err := wire.ReadVarBytes(r, 0, 34, "pkscript")
if err != nil {
return err
}