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 30, 2024
1 parent 5f8451a commit 0e3951e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 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.21

require (
go.etcd.io/bbolt v1.3.8
go.sia.tech/core v0.2.1-0.20240124010156-3ffae341852c
go.sia.tech/core v0.2.1-0.20240130145801-8067f34b2ecc
go.uber.org/zap v1.26.0
golang.org/x/crypto v0.0.0-20220507011949-2cf3adece122
lukechampine.com/frand v1.4.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA=
go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
go.sia.tech/core v0.2.1-0.20240124010156-3ffae341852c h1:hFgv4uH2+wf838W7V0dIVgldjMyje2dkZcCLItu874g=
go.sia.tech/core v0.2.1-0.20240124010156-3ffae341852c/go.mod h1:3EoY+rR78w1/uGoXXVqcYdwSjSJKuEMI5bL7WROA27Q=
go.sia.tech/core v0.2.1-0.20240130145801-8067f34b2ecc h1:oUCCTOatQIwYkJ2FUWRvJtgU+i/BwlzmzCxoSvmmJVQ=
go.sia.tech/core v0.2.1-0.20240130145801-8067f34b2ecc/go.mod h1:3EoY+rR78w1/uGoXXVqcYdwSjSJKuEMI5bL7WROA27Q=
go.sia.tech/mux v1.2.0 h1:ofa1Us9mdymBbGMY2XH/lSpY8itFsKIo/Aq8zwe+GHU=
go.sia.tech/mux v1.2.0/go.mod h1:Yyo6wZelOYTyvrHmJZ6aQfRoer3o4xyKQ4NmQLJrBSo=
go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
Expand Down
21 changes: 15 additions & 6 deletions syncer/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ func (p *Peer) String() string {
return "->" + p.ConnAddr
}

// Addr returns the peer's reported dialback address.
func (p *Peer) Addr() string { return p.t.Addr }

// Version returns the peer's reported version.
func (p *Peer) Version() string { return p.t.Version }

// UniqueID returns the peer's reported UniqueID.
func (p *Peer) UniqueID() gateway.UniqueID { return p.t.UniqueID }

// Err returns the error that caused the peer to disconnect, if any.
func (p *Peer) Err() error {
p.mu.Lock()
Expand All @@ -51,12 +60,6 @@ func (p *Peer) setErr(err error) error {
return p.err
}

// Close closes the peer's connection.
func (p *Peer) Close() error {
p.setErr(errors.New("closing"))
return nil
}

// Synced returns the peer's sync status.
func (p *Peer) Synced() bool {
p.mu.Lock()
Expand All @@ -70,6 +73,12 @@ func (p *Peer) setSynced(synced bool) {
p.synced = synced
}

// Close closes the peer's connection.
func (p *Peer) Close() error {
p.setErr(errors.New("closing"))
return nil
}

func (p *Peer) callRPC(r gateway.Object, timeout time.Duration) error {
s, err := p.t.DialStream()
if err != nil {
Expand Down
5 changes: 2 additions & 3 deletions syncer/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,8 @@ type Syncer struct {
}

func (s *Syncer) resync(p *Peer, reason string) {
alreadyResyncing := !p.Synced()
p.setSynced(false)
if !alreadyResyncing {
if p.Synced() {
p.setSynced(false)
s.log.Debug("resync triggered", zap.String("peer", p.t.Addr), zap.String("reason", reason))
}
}
Expand Down
8 changes: 4 additions & 4 deletions wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ func (t Transaction) EncodeTo(e *types.Encoder) {
t.ID.EncodeTo(e)
t.Index.EncodeTo(e)
t.Transaction.EncodeTo(e)
t.Inflow.EncodeTo(e)
t.Outflow.EncodeTo(e)
types.V2Currency(t.Inflow).EncodeTo(e)
types.V2Currency(t.Outflow).EncodeTo(e)
e.WriteString(string(t.Source))
e.WriteTime(t.Timestamp)
}
Expand All @@ -116,8 +116,8 @@ func (t *Transaction) DecodeFrom(d *types.Decoder) {
t.ID.DecodeFrom(d)
t.Index.DecodeFrom(d)
t.Transaction.DecodeFrom(d)
t.Inflow.DecodeFrom(d)
t.Outflow.DecodeFrom(d)
(*types.V2Currency)(&t.Inflow).DecodeFrom(d)
(*types.V2Currency)(&t.Outflow).DecodeFrom(d)
t.Source = TransactionSource(d.ReadString())
t.Timestamp = d.ReadTime()
}
Expand Down

0 comments on commit 0e3951e

Please sign in to comment.