Skip to content

Commit

Permalink
mod: Update core dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechampine committed Jan 4, 2024
1 parent 8d6da88 commit 6ea33bd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.18

require (
go.etcd.io/bbolt v1.3.7
go.sia.tech/core v0.1.12-0.20240103234000-bae2b8fd3029
go.sia.tech/core v0.1.12-0.20240104213000-41097337c139
go.sia.tech/jape v0.9.0
go.sia.tech/web/walletd v0.10.0
golang.org/x/term v0.6.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
go.sia.tech/core v0.1.12-0.20240103234000-bae2b8fd3029 h1:oYriMRrX0rSaDj9rvupmw2elGAnmjDxAE8zWVVFGuJg=
go.sia.tech/core v0.1.12-0.20240103234000-bae2b8fd3029/go.mod h1:3EoY+rR78w1/uGoXXVqcYdwSjSJKuEMI5bL7WROA27Q=
go.sia.tech/core v0.1.12-0.20240104213000-41097337c139 h1:7/cRTofOXmp150CvEiJQWsYZ+psmzn8bKmA2Jp7V5+0=
go.sia.tech/core v0.1.12-0.20240104213000-41097337c139/go.mod h1:3EoY+rR78w1/uGoXXVqcYdwSjSJKuEMI5bL7WROA27Q=
go.sia.tech/jape v0.9.0 h1:kWgMFqALYhLMJYOwWBgJda5ko/fi4iZzRxHRP7pp8NY=
go.sia.tech/jape v0.9.0/go.mod h1:4QqmBB+t3W7cNplXPj++ZqpoUb2PeiS66RLpXmEGap4=
go.sia.tech/mux v1.2.0 h1:ofa1Us9mdymBbGMY2XH/lSpY8itFsKIo/Aq8zwe+GHU=
Expand Down
15 changes: 11 additions & 4 deletions syncer/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type ChainManager interface {
PoolTransaction(txid types.TransactionID) (types.Transaction, bool)
AddPoolTransactions(txns []types.Transaction) error
V2PoolTransaction(txid types.TransactionID) (types.V2Transaction, bool)
AddV2PoolTransactions(index types.ChainIndex, txns []types.V2Transaction) error
AddV2PoolTransactions(basis types.ChainIndex, txns []types.V2Transaction) error
TransactionsForPartialBlock(missing []types.Hash256) ([]types.Transaction, []types.V2Transaction)
}

Expand Down Expand Up @@ -397,7 +397,7 @@ func (h *rpcHandler) RelayV2BlockOutline(bo gateway.V2BlockOutline, origin *gate
h.s.relayV2BlockOutline(bo, origin) // non-blocking
}

func (h *rpcHandler) RelayV2TransactionSet(index types.ChainIndex, txns []types.V2Transaction, origin *gateway.Peer) {
func (h *rpcHandler) RelayV2TransactionSet(basis types.ChainIndex, txns []types.V2Transaction, origin *gateway.Peer) {
// if we've already seen these transactions, don't relay them again
allSeen := true
for _, txn := range txns {
Expand All @@ -408,11 +408,18 @@ func (h *rpcHandler) RelayV2TransactionSet(index types.ChainIndex, txns []types.
if allSeen {
return
}
if err := h.s.cm.AddV2PoolTransactions(index, txns); err != nil {
if _, ok := h.s.cm.Block(basis.ID); !ok {
h.s.log.Printf("peer %v relayed a v2 transaction set with unknown basis (%v); triggering a resync", origin, basis)
h.s.mu.Lock()
h.s.synced[origin.Addr] = false
h.s.mu.Unlock()
return
}
if err := h.s.cm.AddV2PoolTransactions(basis, txns); err != nil {
h.s.log.Printf("received an invalid transaction set from %v: %v", origin, err)
return
}
h.s.relayV2TransactionSet(index, txns, origin) // non-blocking
h.s.relayV2TransactionSet(basis, txns, origin) // non-blocking
}

func (s *Syncer) ban(p *gateway.Peer, err error) {
Expand Down

0 comments on commit 6ea33bd

Please sign in to comment.