diff --git a/go.mod b/go.mod index eadbc9bc..7f7704ca 100644 --- a/go.mod +++ b/go.mod @@ -11,8 +11,8 @@ require ( github.com/mattn/go-sqlite3 v1.14.22 github.com/shopspring/decimal v1.4.0 gitlab.com/NebulousLabs/encoding v0.0.0-20200604091946-456c3dc907fe - go.sia.tech/core v0.2.6 - go.sia.tech/coreutils v0.0.5 + go.sia.tech/core v0.2.7 + go.sia.tech/coreutils v0.0.6 go.sia.tech/jape v0.11.2-0.20240306154058-9832414a5385 go.sia.tech/siad v1.5.10-0.20230228235644-3059c0b930ca go.sia.tech/web/hostd v0.44.0 diff --git a/go.sum b/go.sum index 49100939..8bfab76d 100644 --- a/go.sum +++ b/go.sum @@ -194,10 +194,10 @@ gitlab.com/NebulousLabs/writeaheadlog v0.0.0-20200618142844-c59a90f49130/go.mod go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.10 h1:+BqfJTcCzTItrop8mq/lbzL8wSGtj94UO/3U31shqG0= go.etcd.io/bbolt v1.3.10/go.mod h1:bK3UQLPJZly7IlNmV7uVHJDxfe5aK9Ll93e/74Y9oEQ= -go.sia.tech/core v0.2.6 h1:JrbZwW4cPHCB2Q6TeqCsAj2GAFXrRqLq0q/GNevtnPU= -go.sia.tech/core v0.2.6/go.mod h1:B7ooFH3F6cLjxQz6IX33kgjOY392Ava7pzpPeccagac= -go.sia.tech/coreutils v0.0.5 h1:Jj03VrqAayYHgA9fwV13+X88WB+Wr1p8wuLw2B8d2FI= -go.sia.tech/coreutils v0.0.5/go.mod h1:SkSpHeq3tBh2ff4HXuBk2WtlhkYQQtdcvU4Yv1Rd2bU= +go.sia.tech/core v0.2.7 h1:9Q/3BHL6ziAMPeiko863hhTD/Zs2s7OqEUiPKouDny8= +go.sia.tech/core v0.2.7/go.mod h1:BMgT/reXtgv6XbDgUYTCPY7wSMbspDRDs7KMi1vL6Iw= +go.sia.tech/coreutils v0.0.6 h1:xLpv3JyvbOoXcX3gC6a6Y3zQ/MZn/fyFvuPIzv/e/Eg= +go.sia.tech/coreutils v0.0.6/go.mod h1:EiDcQk2qLuP32Qoj/XphY9fbjTXphJhJZMERoC4LF0c= go.sia.tech/jape v0.11.2-0.20240306154058-9832414a5385 h1:Gho1g6pkv56o6Ut9cez/Yu5o4xlA8WNkDbPn6RWXL7g= go.sia.tech/jape v0.11.2-0.20240306154058-9832414a5385/go.mod h1:wU+h6Wh5olDjkPXjF0tbZ1GDgoZ6VTi4naFw91yyWC4= go.sia.tech/mux v1.2.0 h1:ofa1Us9mdymBbGMY2XH/lSpY8itFsKIo/Aq8zwe+GHU= diff --git a/persist/sqlite/contracts.go b/persist/sqlite/contracts.go index 4c34b37f..322597e0 100644 --- a/persist/sqlite/contracts.go +++ b/persist/sqlite/contracts.go @@ -988,20 +988,14 @@ func decodeRevision(b []byte, fcr *types.FileContractRevision) error { func encodeTxnSet(txns []types.Transaction) []byte { var buf bytes.Buffer e := types.NewEncoder(&buf) - e.WritePrefix(len(txns)) - for i := range txns { - txns[i].EncodeTo(e) - } + types.EncodeSlice(e, txns) e.Flush() return buf.Bytes() } func decodeTxnSet(b []byte, txns *[]types.Transaction) error { d := types.NewBufDecoder(b) - *txns = make([]types.Transaction, d.ReadPrefix()) - for i := range *txns { - (*txns)[i].DecodeFrom(d) - } + types.DecodeSlice(d, txns) return d.Err() } diff --git a/rhp/v3/execute.go b/rhp/v3/execute.go index 0cc8e070..3bc0526b 100644 --- a/rhp/v3/execute.go +++ b/rhp/v3/execute.go @@ -323,10 +323,9 @@ func (pe *programExecutor) executeSwapSector(instr *rhp3.InstrSwapSector, log *z // encode the old leaf hashes var buf bytes.Buffer enc := types.NewEncoder(&buf) - enc.WritePrefix(len(oldLeafHashes)) - for _, h := range oldLeafHashes { + types.EncodeSliceFn(enc, oldLeafHashes, func(enc *types.Encoder, h types.Hash256) { enc.Write(h[:]) - } + }) if err := enc.Flush(); err != nil { return nil, nil, fmt.Errorf("failed to encode old leaf hashes: %w", err) }