[types] Add max message & block size limit
@@ -7,6 +7,8 @@ import (
)
const MAXBLOCKNO BlockNo = 18446744073709551615
+const maxMetaSizeLimit = uint32(256 << 10)
+const blockSizeHardLimit = uint32(8 << (10 * 2))
func EncodeB64(bs []byte) string {
return base64.StdEncoding.EncodeToString(bs)
@@ -25,3 +27,13 @@ func DecodeB58(sb string) []byte {
buf, _ := base58.Decode(sb)
return buf
}
+
+// MaxMessageSize returns the limit for network message (client-server, p2p) size
+func MaxMessageSize() uint32 {
+ return maxMetaSizeLimit + blockSizeHardLimit
+}
+
+// BlockSizeHardLimit returns the hard limit for block size
+func BlockSizeHardLimit() uint32 {
+ return blockSizeHardLimit
+}
