lnwire: allow up to 35-bytes in pkScripts to account for P2WSH
This commit is contained in:
parent
8081fab8fe
commit
9324a503c9
@ -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
|
||||
}
|
||||
|
@ -153,20 +153,7 @@ func (a *NodeAnnouncement) MsgType() MessageType {
|
||||
//
|
||||
// This is part of the lnwire.Message interface.
|
||||
func (a *NodeAnnouncement) MaxPayloadLength(pver uint32) uint32 {
|
||||
// Signature - 64 bytes
|
||||
// Timestamp - 4 bytes
|
||||
// NodeID - 33 bytes
|
||||
// RGBColor - 3 bytes
|
||||
// Alias - 32 bytes
|
||||
// Features - variable
|
||||
// NumAddresses - 2 bytes
|
||||
// AddressDescriptor - 1 byte
|
||||
// Ipv4 - 4 bytes (optional)
|
||||
// Ipv6 - 16 bytes (optional)
|
||||
// Port - 2 bytes (optional)
|
||||
|
||||
// Base size, 140, but can be variable due to multiple addresses
|
||||
return 8192
|
||||
return 65533
|
||||
}
|
||||
|
||||
// DataToSign returns the part of the message that should be signed.
|
||||
|
@ -147,7 +147,7 @@ func (c *SingleFundingRequest) Encode(w io.Writer, pver uint32) error {
|
||||
c.ConfirmationDepth)
|
||||
}
|
||||
|
||||
// Command returns the uint32 code which uniquely identifies this message as a
|
||||
// MsgType returns the uint32 code which uniquely identifies this message as a
|
||||
// SingleFundingRequest on the wire.
|
||||
//
|
||||
// This is part of the lnwire.Message interface.
|
||||
@ -191,8 +191,8 @@ func (c *SingleFundingRequest) MaxPayloadLength(uint32) uint32 {
|
||||
// ChannelDerivationPoint - 33 bytes
|
||||
length += 33
|
||||
|
||||
// DeliveryPkScript - 25 bytes
|
||||
length += 25
|
||||
// DeliveryPkScript - 34 bytes + 1 byte varInt
|
||||
length += 35
|
||||
|
||||
// DustLimit - 8 bytes
|
||||
length += 8
|
||||
|
@ -145,8 +145,8 @@ func (c *SingleFundingResponse) MaxPayloadLength(uint32) uint32 {
|
||||
// CsvDelay - 4 bytes
|
||||
length += 4
|
||||
|
||||
// DeliveryPkScript - 25 bytes
|
||||
length += 25
|
||||
// DeliveryPkScript - 34 bytes + 1 varInt
|
||||
length += 35
|
||||
|
||||
// DustLimit - 8 bytes
|
||||
length += 8
|
||||
|
Loading…
Reference in New Issue
Block a user