Skip to content

Commit dd84666

Browse files
author
nicholasguoalgorand
authored
txnsync: Add fields to txnsync msgs for proposal sending (#2572)
txnsync: Add fields to txnsync msgs for proposal sending
1 parent 2b43371 commit dd84666

File tree

4 files changed

+290
-7
lines changed

4 files changed

+290
-7
lines changed

txnsync/exchange.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@
1717
package txnsync
1818

1919
import (
20+
"github.com/algorand/go-algorand/crypto"
2021
"github.com/algorand/go-algorand/data/basics"
2122
)
2223

2324
const txnBlockMessageVersion = 1
2425
const maxBloomFilterSize = 100000
2526
const maxAcceptedMsgSeq = 64
2627
const maxEncodedTransactionGroupBytes = 10000000
28+
const maxProposalSize = 350000
2729

2830
type transactionBlockMessage struct {
2931
_struct struct{} `codec:",omitempty,omitemptyarray"` //nolint:structcheck,unused
@@ -34,6 +36,7 @@ type transactionBlockMessage struct {
3436
UpdatedRequestParams requestParams `codec:"p"`
3537
TransactionGroups packedTransactionGroups `codec:"g"`
3638
MsgSync timingParams `codec:"t"`
39+
RelayedProposal relayedProposal `codec:"rp"`
3740
}
3841

3942
type encodedBloomFilter struct {
@@ -73,3 +76,16 @@ type timingParams struct {
7376
AcceptedMsgSeq []uint64 `codec:"a,allocbound=maxAcceptedMsgSeq"`
7477
NextMsgMinDelay uint64 `codec:"m"`
7578
}
79+
80+
const (
81+
noProposal byte = iota
82+
transactionsForProposal
83+
)
84+
85+
type relayedProposal struct {
86+
_struct struct{} `codec:",omitempty,omitemptyarray"`
87+
88+
RawBytes []byte `codec:"b,allocbound=maxProposalSize"`
89+
ExcludeProposal crypto.Digest `codec:"e"`
90+
Content byte `codec:"c"`
91+
}

txnsync/incoming.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,11 @@ func (s *syncState) evaluateIncomingMessage(message incomingMessage) {
231231
// increase the message sequence number, since we're processing this message.
232232
peer.nextReceivedMessageSeq++
233233

234+
// skip txnsync messages with proposalData for now
235+
if !incomingMsg.message.RelayedProposal.MsgIsZero() {
236+
continue
237+
}
238+
234239
// update the round number if needed.
235240
if incomingMsg.message.Round > peer.lastRound {
236241
peer.lastRound = incomingMsg.message.Round

txnsync/msgp_gen.go

Lines changed: 210 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)