Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/overlays/go-overlay-discovery-services/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ require (
// Security: upgrade vulnerable dependencies
replace github.com/gofiber/fiber/v2 => github.com/gofiber/fiber/v2 v2.52.12

replace github.com/opencontainers/runc => github.com/opencontainers/runc v1.4.0
replace github.com/opencontainers/runc => github.com/opencontainers/runc v1.4.2

replace go.opentelemetry.io/otel/sdk => go.opentelemetry.io/otel/sdk v1.42.0
replace go.opentelemetry.io/otel/sdk => go.opentelemetry.io/otel/sdk v1.43.0

require (
filippo.io/bigmod v0.1.1-0.20260103110540-f8a47775ebe5 // indirect
Expand Down Expand Up @@ -65,6 +65,7 @@ require (
github.com/dgraph-io/badger/v4 v4.9.1 // indirect
github.com/dgraph-io/ristretto/v2 v2.4.0 // indirect
github.com/dgryski/go-metro v0.0.0-20250106013310-edb8663e5e33 // indirect
github.com/docker/go-connections v0.7.0 // indirect
github.com/dolthub/maphash v0.1.0 // indirect
github.com/dolthub/swiss v0.2.1 // indirect
github.com/dunglas/httpsfv v1.1.0 // indirect
Expand Down
6 changes: 2 additions & 4 deletions packages/overlays/go-overlay-discovery-services/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ github.com/dgryski/go-metro v0.0.0-20250106013310-edb8663e5e33 h1:ucRHb6/lvW/+mT
github.com/dgryski/go-metro v0.0.0-20250106013310-edb8663e5e33/go.mod h1:c9O8+fpSOX1DM8cPNSkX/qsBWdkD4yd2dpciOWQjpBw=
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
github.com/docker/go-connections v0.6.0 h1:LlMG9azAe1TqfR7sO+NJttz1gy6KO7VJBh+pMmjSD94=
github.com/docker/go-connections v0.6.0/go.mod h1:AahvXYshr6JgfUJGdDCs2b5EZG/vmaMAntpSFH5BFKE=
github.com/docker/go-connections v0.7.0 h1:6SsRfJddP22WMrCkj19x9WKjEDTB+ahsdiGYf0mN39c=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/dolthub/maphash v0.1.0 h1:bsQ7JsF4FkkWyrP3oCnFJgrCUAFbFf3kOl4L/QxPDyQ=
Expand Down Expand Up @@ -864,8 +863,7 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0 h1:3iZJK
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0/go.mod h1:/G+nUPfhq2e+qiXMGxMwumDrP5jtzU+mWN7/sjT2rak=
go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM=
go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY=
go.opentelemetry.io/otel/sdk v1.42.0 h1:LyC8+jqk6UJwdrI/8VydAq/hvkFKNHZVIWuslJXYsDo=
go.opentelemetry.io/otel/sdk v1.42.0/go.mod h1:rGHCAxd9DAph0joO4W6OPwxjNTYWghRWmkHuGbayMts=
go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg=
go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw=
go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A=
go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A=
Expand Down
14 changes: 7 additions & 7 deletions packages/sdk/go-subtree/coinbase_placeholder.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
package subtree

import (
"github.com/bsv-blockchain/go-bt/v2"
"github.com/bsv-blockchain/go-bt/v2/chainhash"
"github.com/bsv-blockchain/go-sdk/chainhash"
"github.com/bsv-blockchain/go-sdk/transaction"
)

var (
Expand Down Expand Up @@ -35,19 +35,19 @@ var (
FrozenBytesTxHash = chainhash.Hash(FrozenBytesTxBytes)
)

func generateCoinbasePlaceholderTx() *bt.Tx {
tx := bt.NewTx()
func generateCoinbasePlaceholderTx() *transaction.Transaction {
tx := transaction.NewTransaction()
tx.Version = 0xFFFFFFFF
tx.LockTime = 0xFFFFFFFF

return tx
}

// IsCoinbasePlaceHolderTx checks if the given transaction is a coinbase placeholder transaction.
func IsCoinbasePlaceHolderTx(tx *bt.Tx) bool {
func IsCoinbasePlaceHolderTx(tx *transaction.Transaction) bool {
coinbasePlaceholderTx := generateCoinbasePlaceholderTx()

coinbasePlaceholderTxHash := coinbasePlaceholderTx.TxIDChainHash()
coinbasePlaceholderTxHash := coinbasePlaceholderTx.TxID()

return tx.TxIDChainHash().IsEqual(coinbasePlaceholderTxHash)
return tx.TxID().IsEqual(coinbasePlaceholderTxHash)
}
10 changes: 5 additions & 5 deletions packages/sdk/go-subtree/coinbase_placeholder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ package subtree
import (
"testing"

"github.com/bsv-blockchain/go-bt/v2"
"github.com/bsv-blockchain/go-sdk/transaction"
"github.com/stretchr/testify/assert"
)

func TestCoinbasePlaceholderTx(t *testing.T) {
coinbasePlaceholderTx := generateCoinbasePlaceholderTx()
coinbasePlaceholderTxHash := coinbasePlaceholderTx.TxIDChainHash()
coinbasePlaceholderTxHash := coinbasePlaceholderTx.TxID()
assert.True(t, IsCoinbasePlaceHolderTx(coinbasePlaceholderTx))
assert.Equal(t, uint32(0xFFFFFFFF), coinbasePlaceholderTx.Version)
assert.Equal(t, uint32(0xFFFFFFFF), coinbasePlaceholderTx.LockTime)
assert.Equal(t, coinbasePlaceholderTxHash, coinbasePlaceholderTx.TxIDChainHash())
assert.False(t, IsCoinbasePlaceHolderTx(bt.NewTx()))
assert.Equal(t, "a8502e9c08b3c851201a71d25bf29fd38a664baedb777318b12d19242f0e46ab", coinbasePlaceholderTx.TxIDChainHash().String())
assert.Equal(t, coinbasePlaceholderTxHash, coinbasePlaceholderTx.TxID())
assert.False(t, IsCoinbasePlaceHolderTx(transaction.NewTransaction()))
assert.Equal(t, "a8502e9c08b3c851201a71d25bf29fd38a664baedb777318b12d19242f0e46ab", coinbasePlaceholderTx.TxID().String())
}
14 changes: 6 additions & 8 deletions packages/sdk/go-subtree/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@ module github.com/bsv-blockchain/go-subtree
go 1.25.0

require (
github.com/bsv-blockchain/go-bt/v2 v2.6.2
github.com/bsv-blockchain/go-safe-conversion v1.1.2
github.com/bsv-blockchain/go-tx-map v1.3.4
github.com/bsv-blockchain/go-sdk v1.2.19
github.com/stretchr/testify v1.11.1
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f
)

require (
github.com/bsv-blockchain/go-sdk v1.2.19 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dolthub/maphash v0.1.0 // indirect
github.com/dolthub/swiss v0.2.1 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
golang.org/x/crypto v0.49.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
golang.org/x/crypto v0.50.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
24 changes: 8 additions & 16 deletions packages/sdk/go-subtree/go.sum
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
github.com/bsv-blockchain/go-bt/v2 v2.6.2 h1:hwces7nj4RMcNpEJxRZSnNVuwvuUbME+oMvtGVzLky4=
github.com/bsv-blockchain/go-bt/v2 v2.6.2/go.mod h1:yAUftVqYfcgYgxVEKtiA/0HXGD1az8MWD3hgnGT/0gM=
github.com/bsv-blockchain/go-safe-conversion v1.1.2 h1:otAM71jUp+rBvEaNjfLTxlBKNnMbdbvDoew7brwPg0k=
github.com/bsv-blockchain/go-safe-conversion v1.1.2/go.mod h1:KwO5HkH9S11kppAm7SedJhgaJnZbUMYRZalSq9fxLHQ=
github.com/bsv-blockchain/go-sdk v1.2.19 h1:KInzoyKp/dh21YiMpPDpKmHu5z37yaQXF02OMZWdsXU=
github.com/bsv-blockchain/go-sdk v1.2.19/go.mod h1:5mmw1QLusuAkjWmQgUOurQYCXdIsQEsWXbAZ9zwme3g=
github.com/bsv-blockchain/go-tx-map v1.3.4 h1:nwR4PdmAt2JJTYkqAlqxxxghYMT0ts2RpqzDq13ohsY=
github.com/bsv-blockchain/go-tx-map v1.3.4/go.mod h1:AiIQRQWbCz9QWrziCFAi9Fu04EygPN1dPB+z7qEyFbg=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dolthub/maphash v0.1.0 h1:bsQ7JsF4FkkWyrP3oCnFJgrCUAFbFf3kOl4L/QxPDyQ=
github.com/dolthub/maphash v0.1.0/go.mod h1:gkg4Ch4CdCDu5h6PMriVLawB7koZ+5ijb9puGMV50a4=
github.com/dolthub/swiss v0.2.1 h1:gs2osYs5SJkAaH5/ggVJqXQxRXtWshF6uE0lgR/Y3Gw=
github.com/dolthub/swiss v0.2.1/go.mod h1:8AhKZZ1HK7g18j7v7k6c5cYIGEZJcPn0ARsai8cUrh0=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4=
golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA=
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa h1:Zt3DZoOFFYkKhDT3v7Lm9FDMEV06GpzjG2jrqW+QTE0=
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa/go.mod h1:K79w1Vqn7PoiZn+TkNpx3BUWUQksGO3JcVX6qIjytmA=
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI=
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f h1:W3F4c+6OLc6H2lb//N1q4WpJkhzJCK5J6kUi1NTVXfM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
Expand Down
18 changes: 9 additions & 9 deletions packages/sdk/go-subtree/inpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"math"
"slices"

"github.com/bsv-blockchain/go-bt/v2"
"github.com/bsv-blockchain/go-bt/v2/chainhash"
"github.com/bsv-blockchain/go-sdk/chainhash"
"github.com/bsv-blockchain/go-sdk/transaction"
)

// Inpoint represents an input point in a transaction, consisting of a parent transaction hash and an index.
Expand Down Expand Up @@ -42,18 +42,18 @@ func NewTxInpoints() TxInpoints {
}

// NewTxInpointsFromTx creates a new TxInpoints object from a given transaction.
func NewTxInpointsFromTx(tx *bt.Tx) (TxInpoints, error) {
func NewTxInpointsFromTx(tx *transaction.Transaction) (TxInpoints, error) {
p := NewTxInpoints()
p.addTx(tx)

return p, nil
}

// NewTxInpointsFromInputs creates a new TxInpoints object from a slice of transaction inputs.
func NewTxInpointsFromInputs(inputs []*bt.Input) (TxInpoints, error) {
func NewTxInpointsFromInputs(inputs []*transaction.TransactionInput) (TxInpoints, error) {
p := TxInpoints{}

tx := &bt.Tx{}
tx := &transaction.Transaction{}
tx.Inputs = inputs

p.addTx(tx)
Expand Down Expand Up @@ -175,17 +175,17 @@ func (p *TxInpoints) Serialize() ([]byte, error) {
}

// addTx adds a transaction to the TxInpoints object, extracting its inputs and updating the parent transaction hashes and indexes.
func (p *TxInpoints) addTx(tx *bt.Tx) {
func (p *TxInpoints) addTx(tx *transaction.Transaction) {
// Do not error out for transactions without inputs, seeded Teranodes will have txs without inputs
for _, input := range tx.Inputs {
hash := *input.PreviousTxIDChainHash()
hash := *input.SourceTXID

index := slices.Index(p.ParentTxHashes, hash)
if index != -1 {
p.Idxs[index] = append(p.Idxs[index], input.PreviousTxOutIndex)
p.Idxs[index] = append(p.Idxs[index], input.SourceTxOutIndex)
} else {
p.ParentTxHashes = append(p.ParentTxHashes, hash)
p.Idxs = append(p.Idxs, []uint32{input.PreviousTxOutIndex})
p.Idxs = append(p.Idxs, []uint32{input.SourceTxOutIndex})
}

p.nrInpoints++
Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/go-subtree/inpoints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"testing"

"github.com/bsv-blockchain/go-bt/v2/chainhash"
"github.com/bsv-blockchain/go-sdk/chainhash"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -68,7 +68,7 @@ func TestGetTxInpoints(t *testing.T) {
inpoints := p.GetTxInpoints()
assert.Len(t, inpoints, 1)
assert.Equal(t, uint32(5), inpoints[0].Index)
assert.Equal(t, *tx.Inputs[0].PreviousTxIDChainHash(), inpoints[0].Hash)
assert.Equal(t, *tx.Inputs[0].SourceTXID, inpoints[0].Hash)
}

func TestGetParentTxHashAtIndex(t *testing.T) {
Expand All @@ -80,7 +80,7 @@ func TestGetParentTxHashAtIndex(t *testing.T) {
hash, err := p.GetParentTxHashAtIndex(0)
require.NoError(t, err)

assert.Equal(t, *tx.Inputs[0].PreviousTxIDChainHash(), hash)
assert.Equal(t, *tx.Inputs[0].SourceTXID, hash)
})

t.Run("out of range", func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/go-subtree/merkle_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"math"
"sync"

"github.com/bsv-blockchain/go-bt/v2/chainhash"
"github.com/bsv-blockchain/go-sdk/chainhash"
)

// GetMerkleProofForCoinbase returns a merkle proof for the coinbase transaction
Expand Down
32 changes: 16 additions & 16 deletions packages/sdk/go-subtree/merkle_tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ package subtree
import (
"testing"

"github.com/bsv-blockchain/go-bt/v2/chainhash"
"github.com/bsv-blockchain/go-sdk/chainhash"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestGetMerkleProofForCoinbase(t *testing.T) {
hash1, _ := chainhash.NewHashFromStr("97af9ad3583e2f83fc1e44e475e3a3ee31ec032449cc88b491479ef7d187c115")
hash2, _ := chainhash.NewHashFromStr("7ce05dda56bc523048186c0f0474eb21c92fe35de6d014bd016834637a3ed08d")
hash3, _ := chainhash.NewHashFromStr("3070fb937289e24720c827cbc24f3fce5c361cd7e174392a700a9f42051609e0")
hash4, _ := chainhash.NewHashFromStr("d3cde0ab7142cc99acb31c5b5e1e941faed1c5cf5f8b63ed663972845d663487")
hash1, _ := chainhash.NewHashFromHex("97af9ad3583e2f83fc1e44e475e3a3ee31ec032449cc88b491479ef7d187c115")
hash2, _ := chainhash.NewHashFromHex("7ce05dda56bc523048186c0f0474eb21c92fe35de6d014bd016834637a3ed08d")
hash3, _ := chainhash.NewHashFromHex("3070fb937289e24720c827cbc24f3fce5c361cd7e174392a700a9f42051609e0")
hash4, _ := chainhash.NewHashFromHex("d3cde0ab7142cc99acb31c5b5e1e941faed1c5cf5f8b63ed663972845d663487")

hash5, _ := chainhash.NewHashFromStr("87af9ad3583e2f83fc1e44e475e3a3ee31ec032449cc88b491479ef7d187c115")
hash6, _ := chainhash.NewHashFromStr("6ce05dda56bc523048186c0f0474eb21c92fe35de6d014bd016834637a3ed08d")
hash7, _ := chainhash.NewHashFromStr("2070fb937289e24720c827cbc24f3fce5c361cd7e174392a700a9f42051609e0")
hash8, _ := chainhash.NewHashFromStr("c3cde0ab7142cc99acb31c5b5e1e941faed1c5cf5f8b63ed663972845d663487")
hash5, _ := chainhash.NewHashFromHex("87af9ad3583e2f83fc1e44e475e3a3ee31ec032449cc88b491479ef7d187c115")
hash6, _ := chainhash.NewHashFromHex("6ce05dda56bc523048186c0f0474eb21c92fe35de6d014bd016834637a3ed08d")
hash7, _ := chainhash.NewHashFromHex("2070fb937289e24720c827cbc24f3fce5c361cd7e174392a700a9f42051609e0")
hash8, _ := chainhash.NewHashFromHex("c3cde0ab7142cc99acb31c5b5e1e941faed1c5cf5f8b63ed663972845d663487")

expectedRootHash := "86867b9f3e7dcb4bdf5b5cc99322122fe492bc466621f3709d4e389e7e14c16c"

Expand Down Expand Up @@ -76,7 +76,7 @@ func TestBuildMerkleTreeStoreFromBytesExtended(t *testing.T) {
})

t.Run("single node", func(t *testing.T) {
hash1, _ := chainhash.NewHashFromStr("97af9ad3583e2f83fc1e44e475e3a3ee31ec032449cc88b491479ef7d187c115")
hash1, _ := chainhash.NewHashFromHex("97af9ad3583e2f83fc1e44e475e3a3ee31ec032449cc88b491479ef7d187c115")
nodes := []Node{
{Hash: *hash1, Fee: 100, SizeInBytes: 200},
}
Expand All @@ -90,8 +90,8 @@ func TestBuildMerkleTreeStoreFromBytesExtended(t *testing.T) {
})

t.Run("two nodes", func(t *testing.T) {
hash1, _ := chainhash.NewHashFromStr("97af9ad3583e2f83fc1e44e475e3a3ee31ec032449cc88b491479ef7d187c115")
hash2, _ := chainhash.NewHashFromStr("7ce05dda56bc523048186c0f0474eb21c92fe35de6d014bd016834637a3ed08d")
hash1, _ := chainhash.NewHashFromHex("97af9ad3583e2f83fc1e44e475e3a3ee31ec032449cc88b491479ef7d187c115")
hash2, _ := chainhash.NewHashFromHex("7ce05dda56bc523048186c0f0474eb21c92fe35de6d014bd016834637a3ed08d")
nodes := []Node{
{Hash: *hash1, Fee: 100, SizeInBytes: 200},
{Hash: *hash2, Fee: 150, SizeInBytes: 250},
Expand All @@ -104,10 +104,10 @@ func TestBuildMerkleTreeStoreFromBytesExtended(t *testing.T) {
})

t.Run("multiple nodes", func(t *testing.T) {
hash1, _ := chainhash.NewHashFromStr("97af9ad3583e2f83fc1e44e475e3a3ee31ec032449cc88b491479ef7d187c115")
hash2, _ := chainhash.NewHashFromStr("7ce05dda56bc523048186c0f0474eb21c92fe35de6d014bd016834637a3ed08d")
hash3, _ := chainhash.NewHashFromStr("3070fb937289e24720c827cbc24f3fce5c361cd7e174392a700a9f42051609e0")
hash4, _ := chainhash.NewHashFromStr("d3cde0ab7142cc99acb31c5b5e1e941faed1c5cf5f8b63ed663972845d663487")
hash1, _ := chainhash.NewHashFromHex("97af9ad3583e2f83fc1e44e475e3a3ee31ec032449cc88b491479ef7d187c115")
hash2, _ := chainhash.NewHashFromHex("7ce05dda56bc523048186c0f0474eb21c92fe35de6d014bd016834637a3ed08d")
hash3, _ := chainhash.NewHashFromHex("3070fb937289e24720c827cbc24f3fce5c361cd7e174392a700a9f42051609e0")
hash4, _ := chainhash.NewHashFromHex("d3cde0ab7142cc99acb31c5b5e1e941faed1c5cf5f8b63ed663972845d663487")
nodes := []Node{
{Hash: *hash1, Fee: 100, SizeInBytes: 200},
{Hash: *hash2, Fee: 150, SizeInBytes: 250},
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/go-subtree/mmap_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"runtime"
"testing"

"github.com/bsv-blockchain/go-bt/v2/chainhash"
"github.com/bsv-blockchain/go-sdk/chainhash"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/go-subtree/mmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"path/filepath"
"testing"

"github.com/bsv-blockchain/go-bt/v2/chainhash"
"github.com/bsv-blockchain/go-sdk/chainhash"
"github.com/stretchr/testify/require"
)

Expand Down
5 changes: 2 additions & 3 deletions packages/sdk/go-subtree/subtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ import (
"math"
"sync"

"github.com/bsv-blockchain/go-bt/v2/chainhash"
"github.com/bsv-blockchain/go-sdk/chainhash"
safe "github.com/bsv-blockchain/go-safe-conversion"
txmap "github.com/bsv-blockchain/go-tx-map"
)

// Node represents a node in the subtree.
Expand Down Expand Up @@ -504,7 +503,7 @@ func (st *Subtree) GetMap() (TxMap, error) {
return nil, err
}

m := txmap.NewSwissMapUint64(lengthUint32)
m := newHashMap(lengthUint32)
for idx, node := range st.Nodes {
_ = m.Put(node.Hash, uint64(idx))
}
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/go-subtree/subtree_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"encoding/binary"
"testing"

"github.com/bsv-blockchain/go-bt/v2/chainhash"
"github.com/bsv-blockchain/go-sdk/chainhash"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down
Loading
Loading