1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
// Copyright (C) 2019-2021 Algorand, Inc.
// This file is part of go-algorand
//
// go-algorand is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// go-algorand is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with go-algorand. If not, see <https://www.gnu.org/licenses/>.
package txnsync
import (
"github.com/algorand/go-algorand/crypto"
"github.com/algorand/go-algorand/data/basics"
)
const txnBlockMessageVersion = 1
const maxBloomFilterSize = 100000
const maxAcceptedMsgSeq = 64
const maxEncodedTransactionGroupBytes = 10000000
const maxProposalSize = 350000
type transactionBlockMessage struct {
_struct struct{} `codec:",omitempty,omitemptyarray"` //nolint:structcheck,unused
Version int32 `codec:"v"`
Round basics.Round `codec:"r"`
TxnBloomFilter encodedBloomFilter `codec:"b"`
UpdatedRequestParams requestParams `codec:"p"`
TransactionGroups packedTransactionGroups `codec:"g"`
MsgSync timingParams `codec:"t"`
RelayedProposal relayedProposal `codec:"rp"`
}
type encodedBloomFilter struct {
_struct struct{} `codec:",omitempty,omitemptyarray"` //nolint:structcheck,unused
BloomFilterType byte `codec:"t"`
EncodingParams requestParams `codec:"p"`
BloomFilter []byte `codec:"f,allocbound=maxBloomFilterSize"`
ClearPrevious byte `codec:"c"`
}
type requestParams struct {
_struct struct{} `codec:",omitempty,omitemptyarray"` //nolint:structcheck,unused
Offset byte `codec:"o"`
Modulator byte `codec:"m"`
}
const (
compressionFormatNone byte = iota
compressionFormatDeflate
)
type packedTransactionGroups struct {
_struct struct{} `codec:",omitempty,omitemptyarray"` //nolint:structcheck,unused
Bytes []byte `codec:"g,allocbound=maxEncodedTransactionGroupBytes"`
CompressionFormat byte `codec:"c"`
LenDecompressedBytes uint64 `codec:"l"`
}
type timingParams struct {
_struct struct{} `codec:",omitempty,omitemptyarray"` //nolint:structcheck,unused
RefTxnBlockMsgSeq uint64 `codec:"s"`
ResponseElapsedTime uint64 `codec:"r"`
AcceptedMsgSeq []uint64 `codec:"a,allocbound=maxAcceptedMsgSeq"`
NextMsgMinDelay uint64 `codec:"m"`
}
const (
noProposal byte = iota //nolint:deadcode,unused,varcheck
transactionsForProposal //nolint:deadcode,unused,varcheck
)
type relayedProposal struct {
_struct struct{} `codec:",omitempty,omitemptyarray"`
RawBytes []byte `codec:"b,allocbound=maxProposalSize"`
ExcludeProposal crypto.Digest `codec:"e"`
Content byte `codec:"c"`
}
|