Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
548b26a
tests: fix flaky TestApplicationsUpgradeOverREST (#6256)
algorandskiy Feb 15, 2025
78b1200
Config: Add TELEMETRY_URL support for telemetry configuration (#6237)
pbennett Feb 18, 2025
be09340
CICD: go-algorand relstable4.0.2-remerge mergeback (#6258)
Algo-devops-service Feb 19, 2025
5f12e1a
network: tiny speedup, less allocation (#6246)
jannotti Feb 19, 2025
1d93b27
txHandler: do not drop accepted mgs (#6257)
algorandskiy Feb 20, 2025
82221c2
tests: fix flaky TestLedgerErrorValidate (#6259)
algorandskiy Feb 20, 2025
116794e
Build: Bump Ubuntu version in codegen_verification job. (#6260)
gmalouf Feb 20, 2025
3c4d601
p2p: fan in incoming txns into backlog worker (#6126)
algorandskiy Feb 21, 2025
b9b6959
goal: added "wallet rename" (#6161)
tasosbit Feb 21, 2025
113b0c3
txHandler: Use IP address instead of IP:port pair (#6176)
algorandskiy Feb 21, 2025
fd2f520
algod: Add static EnableTelemetry retry (#6183)
urtho Feb 24, 2025
ad57857
goal: non-interactive wallet creation with "wallet new --unencrypted …
tasosbit Feb 24, 2025
dc38f7b
goal: Improve logicsig with signer support for clerk send (#6180)
nullun Feb 26, 2025
02bfca4
network: allow multi-role phonebook entries (#6131)
algorandskiy Feb 27, 2025
f468e57
network: fix peerstore Get/Put races (#6261)
algorandskiy Mar 3, 2025
d44aa2d
catchpointdump: support p2p nodes (#6266)
algorandskiy Mar 5, 2025
ad30cd6
p2p: fix http RoundTripper (#6267)
algorandskiy Mar 7, 2025
269945c
build: stop duplicate library LDFLAGS warning (#6268)
cce Mar 7, 2025
cbfa226
Performance: Node benchmarking utility (#6198)
urtho Mar 10, 2025
f53eaeb
build(deps): bump jinja2 from 3.1.5 to 3.1.6 in /test/heapwatch (#6271)
dependabot[bot] Mar 12, 2025
3a0cd6e
test: add OverrideKmdConfig to libgoalFixture (#6269)
algorandskiy Mar 12, 2025
f6cc4e2
util: implement GetTotalMemory for mac and windows (#6272)
algorandskiy Mar 13, 2025
272ec02
catchup: improve classBasedPeerSelector on small peer sets (#6277)
algorandskiy Mar 14, 2025
e10cc09
test: fix flaky TestExactAccountChunk again (#6278)
cce Mar 17, 2025
52ab8e7
kmd: upgrade karalabe/usb to karalabe/hid (#6282)
nullun Mar 19, 2025
55011f9
network: remove GossipNode.BroadcastArray (#6281)
cce Mar 19, 2025
8c5fd63
build(deps): bump golang.org/x/net from 0.33.0 to 0.36.0 (#6275)
dependabot[bot] Mar 27, 2025
5b9eee2
API: box paging (#6279)
jannotti Mar 28, 2025
160bcf3
Txn: Refactor some stateless checks on transactions (#6287)
jannotti Mar 31, 2025
f8ec83f
DevOps: fix golang version handling in bash scripts (#6288)
onetechnical Apr 1, 2025
558bcc3
API: Enable gzip middleware and test for it (#6284)
jannotti Apr 3, 2025
756dfd8
Test: Wait for the box list to be for the commit round (#6294)
jannotti Apr 7, 2025
79b65c7
catchpoint: handle loadFromDisk/recoverFromCrash during first stage c…
cce Apr 8, 2025
9d579da
ledger: fix exceeding offline rows in online accounts table (#6295)
algorandskiy Apr 8, 2025
5eaeb44
util: only set rlimit if needed (#6289)
cce Apr 9, 2025
b2672b4
build: Add preliminary RISC-V (riscv64) build support (#6285)
nullun Apr 9, 2025
6221196
Node Exporter: update dependencies and add darwin universal support (…
onetechnical Apr 9, 2025
e5f403f
tools: Add catchpointdump msgpack decode feature (#6292)
cce Apr 10, 2025
e09cd84
Tools: rotate algoh logs (#6291)
onetechnical Apr 11, 2025
258cedf
p2p: fix DHT FindPeer internal buffer size (#6299)
algorandskiy Apr 11, 2025
272f63e
Merge remote-tracking branch 'origin/rel/stable' into relstable4.0.3-…
Algo-devops-service Apr 14, 2025
3bbbf53
Bump Version, Remove buildnumber.dat and genesistimestamp.dat files.
Algo-devops-service Apr 14, 2025
5c49e9a
Merge pull request #6301 from Algo-devops-service/relstable4.0.3-remerge
algojohnlee Apr 15, 2025
1f5c06b
REST API: genesis endpoint schema definition (#6157)
PhearZero Apr 30, 2025
8341e41
Apps: Add an auto incrementing Version field to apps (#6283)
jannotti May 1, 2025
c95bb50
API: Use integer and uint64 to better express the genesis schema (#6311)
jannotti May 5, 2025
e4c416a
testing: remove basics AccountData.OnlineAccountData conversion funct…
cce May 6, 2025
5d1d36e
ledger: fix duplicate empty rows for suspended accounts (#6314)
algorandskiy May 6, 2025
039c933
CI: fix some linter advice for old code (#6315)
cce May 6, 2025
8521387
network: stateless vote compression (#6276)
cce May 7, 2025
005bf7e
tests: fix TestP2PRelay data race (#6316)
algorandskiy May 7, 2025
48e45d0
network: close p2p conn in CloseWithoutFlush (#6308)
algorandskiy May 9, 2025
f13575c
tests: fix TestP2PEnableGossipService_BothDisable (#6320)
algorandskiy May 9, 2025
8118cfe
CI: use partitiontest for Fuzz tests (#6321)
cce May 12, 2025
18990e0
Testing: Remove sd.Valid() (#6323)
jannotti May 13, 2025
79b0182
p2p: peer metainfo support (#6312)
algorandskiy May 15, 2025
a3563ef
p2p: reduce severity of failed capabilities advertisement (#6318)
algorandskiy May 15, 2025
a985bcb
Update the Version, BuildNumber, genesistimestamp.data
Algo-devops-service May 15, 2025
7c333ef
Merge pull request #6327 from Algo-devops-service/relbeta4.1.0
algojohnlee May 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 6 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ linters:
- misspell
- nilerr
- nolintlint
- paralleltest
- revive
- staticcheck
- typecheck
- paralleltest
- unused

severity:
Expand Down Expand Up @@ -124,6 +124,8 @@ issues:
linters: unused
- path: tools/
linters: unused
- path: daemon/kmd/lib/kmdapi/
linters: unused
- path: _test\.go
linters:
- errcheck
Expand All @@ -142,6 +144,9 @@ issues:
linters:
- staticcheck
text: "SA4006: this value" # of X is never used
- linters:
- staticcheck
text: "(SA3001|SA1019):"
- path: _test\.go
linters:
- revive
Expand Down
18 changes: 12 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ export GOTESTCOMMAND=gotestsum --format pkgname --jsonfile testresults.json --
endif

ifeq ($(OS_TYPE), darwin)
# For Xcode >= 15, set -no_warn_duplicate_libraries linker option
CLANG_MAJOR_VERSION := $(shell clang --version | grep '^Apple clang version ' | awk '{print $$4}' | cut -d. -f1)
ifeq ($(shell [ $(CLANG_MAJOR_VERSION) -ge 15 ] && echo true), true)
EXTLDFLAGS := -Wl,-no_warn_duplicate_libraries
endif
# M1 Mac--homebrew install location in /opt/homebrew
ifeq ($(ARCH), arm64)
export CPATH=/opt/homebrew/include
Expand Down Expand Up @@ -148,6 +143,13 @@ generate: deps

msgp: $(patsubst %,%/msgp_gen.go,$(MSGP_GENERATE))

api:
make -C daemon/algod/api

logic:
make -C data/transactions/logic


%/msgp_gen.go: deps ALWAYS
@set +e; \
printf "msgp: $(@D)..."; \
Expand Down Expand Up @@ -335,7 +337,11 @@ node_exporter: $(GOPATH1)/bin/node_exporter
$(GOPATH1)/bin/node_exporter:
mkdir -p $(GOPATH1)/bin && \
cd $(GOPATH1)/bin && \
tar -xzvf $(SRCPATH)/installer/external/node_exporter-stable-$(shell ./scripts/ostype.sh)-$(shell uname -m | tr '[:upper:]' '[:lower:]').tar.gz && \
if [ -z "$(CROSS_COMPILE_ARCH)" ]; then \
tar -xzvf $(SRCPATH)/installer/external/node_exporter-stable-$(shell ./scripts/ostype.sh)-$(shell uname -m | tr '[:upper:]' '[:lower:]').tar.gz; \
else \
tar -xzvf $(SRCPATH)/installer/external/node_exporter-stable-$(shell ./scripts/ostype.sh)-universal.tar.gz; \
fi && \
cd -

# deploy
Expand Down
1 change: 0 additions & 1 deletion agreement/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,6 @@ func (c checkpointAction) do(ctx context.Context, s *Service) {
// we don't expect this to happen in recovery
s.log.with(logEvent).Errorf("checkpoint action for (%v, %v, %v) reached with nil completion channel", c.Round, c.Period, c.Step)
}
return
}

func (c checkpointAction) String() string {
Expand Down
4 changes: 2 additions & 2 deletions agreement/agreementtest/simulate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func (l *testLedger) LookupAgreement(r basics.Round, a basics.Address) (basics.O
err := fmt.Errorf("Lookup called on future round: %v > %v! (this is probably a bug)", r, l.nextRound)
panic(err)
}
return l.state[a].OnlineAccountData(), nil
return basics_testing.OnlineAccountData(l.state[a]), nil
}

func (l *testLedger) Circulation(r basics.Round, voteRnd basics.Round) (basics.MicroAlgos, error) {
Expand All @@ -222,7 +222,7 @@ func (l *testLedger) Circulation(r basics.Round, voteRnd basics.Round) (basics.M
var sum basics.MicroAlgos
var overflowed bool
for _, rec := range l.state {
sum, overflowed = basics.OAddA(sum, rec.OnlineAccountData().VotingStake())
sum, overflowed = basics.OAddA(sum, basics_testing.OnlineAccountData(rec).VotingStake())
if overflowed {
panic("circulation computation overflowed")
}
Expand Down
2 changes: 1 addition & 1 deletion agreement/autopsy.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func (a *Autopsy) extractNextCdv(ch chan<- autopsyTrace) (bounds AutopsyBounds,
close(pch)
}

pch = make(chan autopsyPair, 0)
pch = make(chan autopsyPair)
acc = autopsyTrace{m: acc.m, p: pch}
err = protocol.DecodeStream(a, &acc.x)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion agreement/certificate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func TestCertificateCertWrongRound(t *testing.T) {
ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture100()
round := ledger.NextRound()
period := period(0)
block := makeRandomBlock(1 - 1)
block := makeRandomBlock(0)

votes := make([]vote, 0)
equiVotes := make([]equivocationVote, 0)
Expand Down
5 changes: 3 additions & 2 deletions agreement/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/algorand/go-algorand/config"
"github.com/algorand/go-algorand/crypto"
"github.com/algorand/go-algorand/data/basics"
basics_testing "github.com/algorand/go-algorand/data/basics/testing"
"github.com/algorand/go-algorand/data/bookkeeping"
"github.com/algorand/go-algorand/data/committee"
"github.com/algorand/go-algorand/logging"
Expand Down Expand Up @@ -332,7 +333,7 @@ func (l *testLedger) LookupAgreement(r basics.Round, a basics.Address) (basics.O
return basics.OnlineAccountData{}, &LedgerDroppedRoundError{}
}

return l.state[a].OnlineAccountData(), nil
return basics_testing.OnlineAccountData(l.state[a]), nil
}

func (l *testLedger) Circulation(r basics.Round, voteRnd basics.Round) (basics.MicroAlgos, error) {
Expand All @@ -347,7 +348,7 @@ func (l *testLedger) Circulation(r basics.Round, voteRnd basics.Round) (basics.M
var sum basics.MicroAlgos
var overflowed bool
for _, rec := range l.state {
sum, overflowed = basics.OAddA(sum, rec.OnlineAccountData().VotingStake())
sum, overflowed = basics.OAddA(sum, basics_testing.OnlineAccountData(rec).VotingStake())
if overflowed {
panic("circulation computation overflowed")
}
Expand Down
5 changes: 3 additions & 2 deletions agreement/fuzzer/ledger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/algorand/go-algorand/config"
"github.com/algorand/go-algorand/crypto"
"github.com/algorand/go-algorand/data/basics"
basics_testing "github.com/algorand/go-algorand/data/basics/testing"
"github.com/algorand/go-algorand/data/bookkeeping"
"github.com/algorand/go-algorand/data/committee"
"github.com/algorand/go-algorand/protocol"
Expand Down Expand Up @@ -241,7 +242,7 @@ func (l *testLedger) LookupAgreement(r basics.Round, a basics.Address) (basics.O
err := fmt.Errorf("Lookup called on future round: %d >= %d! (this is probably a bug)", r, l.nextRound)
panic(err)
}
return l.state[a].OnlineAccountData(), nil
return basics_testing.OnlineAccountData(l.state[a]), nil
}

func (l *testLedger) Circulation(r basics.Round, voteRnd basics.Round) (basics.MicroAlgos, error) {
Expand All @@ -256,7 +257,7 @@ func (l *testLedger) Circulation(r basics.Round, voteRnd basics.Round) (basics.M
var sum basics.MicroAlgos
var overflowed bool
for _, rec := range l.state {
sum, overflowed = basics.OAddA(sum, rec.OnlineAccountData().VotingStake())
sum, overflowed = basics.OAddA(sum, basics_testing.OnlineAccountData(rec).VotingStake())
if overflowed {
panic("circulation computation overflowed")
}
Expand Down
10 changes: 0 additions & 10 deletions agreement/gossip/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package gossip

import (
"context"
"time"

"github.com/algorand/go-algorand/agreement"
"github.com/algorand/go-algorand/config"
Expand Down Expand Up @@ -179,12 +178,3 @@ func (i *networkImpl) Disconnect(h agreement.MessageHandle) {

i.net.Disconnect(metadata.raw.Sender)
}

// broadcastTimeout is currently only used by test code.
// In test code we want to queue up a bunch of outbound packets and then see that they got through, so we need to wait at least a little bit for them to all go out.
// Normal agreement state machine code uses GossipNode.Broadcast non-blocking and may drop outbound packets.
func (i *networkImpl) broadcastTimeout(t protocol.Tag, data []byte, timeout time.Duration) error {
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
return i.net.Broadcast(ctx, t, data, true, nil)
}
2 changes: 1 addition & 1 deletion agreement/persistence.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ func (p *asyncPersistenceLoop) loop(ctx context.Context) {
select {
case <-ctx.Done():
return
case s, _ = <-p.pending:
case s = <-p.pending:
}

// make sure that the ledger finished writing the previous round to disk.
Expand Down
2 changes: 1 addition & 1 deletion agreement/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ func (p *player) issueFastVote(r routerHandle) (actions []action) {

func (p *player) handleCheckpointEvent(r routerHandle, e checkpointEvent) []action {
return []action{
checkpointAction{
checkpointAction{ //nolint:gosimple // explicit assignment for clarity
Round: e.Round,
Period: e.Period,
Step: e.Step,
Expand Down
16 changes: 15 additions & 1 deletion agreement/vote.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ func (uv unauthenticatedVote) verify(l LedgerReader) (vote, error) {
return vote{R: rv, Cred: cred, Sig: uv.Sig}, nil
}

var (
// testMakeVoteCheck is a function that can be set to check every
// unauthenticatedVote before it is returned by makeVote. It is only set by tests.
testMakeVoteCheck func(*unauthenticatedVote) error
)

// makeVote creates a new unauthenticated vote from its constituent components.
//
// makeVote returns an error if it fails.
Expand Down Expand Up @@ -178,7 +184,15 @@ func makeVote(rv rawVote, voting crypto.OneTimeSigner, selection *crypto.VRFSecr
}

cred := committee.MakeCredential(&selection.SK, m.Selector)
return unauthenticatedVote{R: rv, Cred: cred, Sig: sig}, nil
ret := unauthenticatedVote{R: rv, Cred: cred, Sig: sig}

// for use when running in tests
if testMakeVoteCheck != nil {
if testErr := testMakeVoteCheck(&ret); testErr != nil {
return unauthenticatedVote{}, fmt.Errorf("makeVote: testMakeVoteCheck failed: %w", testErr)
}
}
return ret, nil
}

// ToBeHashed implements the Hashable interface.
Expand Down
32 changes: 32 additions & 0 deletions agreement/vote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
package agreement

import (
"bytes"
"encoding/base64"
"encoding/hex"
"fmt"
"os"
"testing"

Expand All @@ -27,10 +31,38 @@ import (
"github.com/algorand/go-algorand/data/basics"
"github.com/algorand/go-algorand/data/committee"
"github.com/algorand/go-algorand/logging"
"github.com/algorand/go-algorand/network/vpack"
"github.com/algorand/go-algorand/protocol"
"github.com/algorand/go-algorand/test/partitiontest"
)

func init() {
testMakeVoteCheck = testVPackMakeVote
}

func testVPackMakeVote(v *unauthenticatedVote) error {
vbuf := protocol.Encode(v)
enc := vpack.NewStatelessEncoder()
dec := vpack.NewStatelessDecoder()
encBuf, err := enc.CompressVote(nil, vbuf)
if err != nil {
return fmt.Errorf("makeVote: failed to parse vote msgpack: %v", err)
}
decBuf, err := dec.DecompressVote(nil, encBuf)
if err != nil {
return fmt.Errorf("makeVote: failed to decompress vote msgpack: %v", err)
}
if !bytes.Equal(vbuf, decBuf) {
fmt.Printf("vote: %+v\n", v)
fmt.Printf("oldbuf: %s\n", hex.EncodeToString(vbuf))
fmt.Printf("decbuf: %s\n", hex.EncodeToString(decBuf))
fmt.Printf("base64 oldbuf: %s\n", base64.StdEncoding.EncodeToString(vbuf))
fmt.Printf("base64 decbuf: %s\n", base64.StdEncoding.EncodeToString(decBuf))
return fmt.Errorf("makeVote: decompressed vote msgpack does not match original")
}
return nil
}

// error is set if this address is not selected
func makeVoteTesting(addr basics.Address, vrfSecs *crypto.VRFSecrets, otSecs crypto.OneTimeSigner, ledger Ledger, round basics.Round, period period, step step, digest crypto.Digest) (vote, error) {
var proposal proposalValue
Expand Down
2 changes: 1 addition & 1 deletion buildnumber.dat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3
0
7 changes: 4 additions & 3 deletions catchup/catchpointService.go
Original file line number Diff line number Diff line change
Expand Up @@ -763,9 +763,8 @@ func (cs *CatchpointCatchupService) updateNodeCatchupMode(catchupModeEnabled boo
case newCtx, open := <-newCtxCh:
if open {
cs.ctx, cs.cancelCtxFunc = context.WithCancel(newCtx)
} else {
// channel is closed, this means that the node is stopping
}
// if channel is closed, this means that the node is stopping
case <-cs.ctx.Done():
// the node context was canceled before the SetCatchpointCatchupMode goroutine had
// the chance of completing. We At this point, the service is shutting down. However,
Expand Down Expand Up @@ -823,12 +822,14 @@ func (cs *CatchpointCatchupService) checkLedgerDownload() error {
for i := 0; i < cs.config.CatchupLedgerDownloadRetryAttempts; i++ {
psp, peerError := cs.blocksDownloadPeerSelector.getNextPeer()
if peerError != nil {
return err
cs.log.Debugf("checkLedgerDownload: error on getNextPeer: %s", peerError.Error())
return peerError
}
err = ledgerFetcher.headLedger(context.Background(), psp.Peer, round)
if err == nil {
return nil
}
cs.log.Debugf("checkLedgerDownload: failed to headLedger from peer %s: %v", peerAddress(psp.Peer), err)
// a non-nil error means that the catchpoint is not available, so we should rank it accordingly
cs.blocksDownloadPeerSelector.rankPeer(psp, peerRankNoCatchpointForRound)
}
Expand Down
10 changes: 8 additions & 2 deletions catchup/classBasedPeerSelector.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ package catchup

import (
"errors"
"time"

"github.com/algorand/go-algorand/network"
"github.com/algorand/go-deadlock"
"time"
)

// classBasedPeerSelector is a rankPooledPeerSelector that tracks and ranks classes of peers based on their response behavior.
Expand Down Expand Up @@ -56,8 +57,13 @@ func (c *classBasedPeerSelector) rankPeer(psp *peerSelectorPeer, rank int) (int,
}

// Peer was in this class, if there was any kind of download issue, we increment the failure count
if rank >= peerRankNoBlockForRound {
failure := rank >= peerRankNoBlockForRound
if failure {
wp.downloadFailures++
} else {
// class usually multiple peers and we do not want to punish the entire class for one peer's failure
// by decrementing the downloadFailures
wp.downloadFailures = max(wp.downloadFailures-1, 0)
}

break
Expand Down
10 changes: 8 additions & 2 deletions catchup/classBasedPeerSelector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
package catchup

import (
"testing"
"time"

"github.com/algorand/go-algorand/network"
"github.com/algorand/go-algorand/test/partitiontest"
"github.com/stretchr/testify/require"
"testing"
"time"
)

// Use to mock the wrapped peer selectors where warranted
Expand Down Expand Up @@ -481,6 +482,7 @@ func TestClassBasedPeerSelector_integration(t *testing.T) {
require.Nil(t, err)
require.Equal(t, mockP1WrappedPeer, peerResult)
cps.rankPeer(mockP1WrappedPeer, peerRankNoBlockForRound)
cps.rankPeer(mockP1WrappedPeer, peerRankNoBlockForRound)

peerResult, err = cps.getNextPeer()
require.Nil(t, err)
Expand All @@ -495,4 +497,8 @@ func TestClassBasedPeerSelector_integration(t *testing.T) {

require.Equal(t, 4, cps.peerSelectors[0].downloadFailures)
require.Equal(t, 0, cps.peerSelectors[1].downloadFailures)

// make sure successful download decreases download failures
cps.rankPeer(mockP1WrappedPeer, durationRank)
require.Equal(t, 3, cps.peerSelectors[0].downloadFailures)
}
5 changes: 2 additions & 3 deletions catchup/fetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,8 @@ func (p *testUnicastPeer) Request(ctx context.Context, tag protocol.Tag, topics
func (p *testUnicastPeer) Respond(ctx context.Context, reqMsg network.IncomingMessage, outMsg network.OutgoingMessage) (e error) {

hashKey := uint64(0)
channel, found := p.responseChannels[hashKey]
if !found {
}
require.Contains(p.t, p.responseChannels, hashKey)
channel := p.responseChannels[hashKey]

select {
case channel <- &network.Response{Topics: outMsg.Topics}:
Expand Down
Loading
Loading