From c382d0a9b8a657e698ea7b9980b3494f49efe40e Mon Sep 17 00:00:00 2001 From: Darren Kellenschwiler Date: Mon, 25 Mar 2024 13:17:19 -0500 Subject: [PATCH 1/8] [fix] optimize the BUMP calculation function to make it O(log(n)) Signed-off-by: Darren Kellenschwiler --- bump.go | 78 ++++++++++++++++++++++++++------------------------------- 1 file changed, 35 insertions(+), 43 deletions(-) diff --git a/bump.go b/bump.go index bf1b4ab..b856001 100644 --- a/bump.go +++ b/bump.go @@ -225,63 +225,55 @@ func NewBUMPFromMerkleTreeAndIndex(blockHeight uint64, merkleTree []*chainhash.H } t := true + txid := merkleTree[txIndex].String() + txidLeaf := leaf{Txid: &t, Hash: &txid, Offset: &txIndex} + oddTxIndex := false + numOfTxids := (len(merkleTree) + 1) / 2 treeHeight := int(math.Log2(float64(numOfTxids))) numOfHashes := numOfTxids - if len(merkleTree) == 0 { + switch len(merkleTree) { + case 0: return nil, errors.New("merkle tree is empty") - } - - // these are the offsets for the txid we're interested in. - offsets := make([]uint64, treeHeight) - for i := 0; i < treeHeight; i++ { - if txIndex>>uint64(i)&1 == 0 { - offsets[i] = txIndex>>uint64(i) + 1 - } else { - offsets[i] = txIndex>>uint64(i) - 1 - } - } - - // if we have only one transaction in the block there is no merkle path to calculate - if len(merkleTree) != 1 { + case 1: + // if we have only one transaction in the block there is no merkle path to calculate + sh := merkleTree[0].String() + o := uint64(0) + bump.Path = [][]leaf{{leaf{Hash: &sh, Offset: &o, Txid: &t}}} + return bump, nil + default: // if our hash index is odd the next hash of the path is the previous element in the array otherwise the next element. levelOffset := 0 for height := 0; height < treeHeight; height++ { leaves := []leaf{} bump.Path = append(bump.Path, leaves) - for offset := 0; offset < numOfHashes; offset++ { - o := uint64(offset) - // only include the hashes for the txid we're interested in. - if height == 0 { - if o != txIndex && o != offsets[height] { - continue - } - } else { - if o != offsets[height] { - continue - } - } - thisLeaf := leaf{Offset: &o} - hash := merkleTree[levelOffset+offset] - if hash.IsEqual(nil) { - thisLeaf.Duplicate = &t - } else { - sh := hash.String() - thisLeaf.Hash = &sh - if height == 0 && txIndex == o { - thisLeaf.Txid = &t - } - } - bump.Path[height] = append(bump.Path[height], thisLeaf) + offset := txIndex >> uint64(height) + if offset&1 == 0 { + offset++ + } else { + oddTxIndex = true + offset-- + } + thisLeaf := leaf{Offset: &offset} + hash := merkleTree[levelOffset+int(offset)] + if hash.IsEqual(nil) { + thisLeaf.Duplicate = &t + } else { + sh := hash.String() + thisLeaf.Hash = &sh } + bump.Path[height] = append(bump.Path[height], thisLeaf) levelOffset += numOfHashes numOfHashes >>= 1 } - } else { - sh := merkleTree[0].String() - o := uint64(0) - bump.Path = [][]leaf{{leaf{Hash: &sh, Offset: &o, Txid: &t}}} + if oddTxIndex { + // if the txIndex is odd we need to add the txid to the path. + bump.Path[0] = append(bump.Path[0], txidLeaf) + } else { + // otherwise prepend it. + bump.Path[0] = append([]leaf{txidLeaf}, bump.Path[0]...) + } } return bump, nil From 9a448e79f1b3f210ac35a8f6211eb6a113b615cc Mon Sep 17 00:00:00 2001 From: Darren Kellenschwiler Date: Mon, 25 Mar 2024 13:50:01 -0500 Subject: [PATCH 2/8] benchmark it Signed-off-by: Darren Kellenschwiler --- bump_test.go | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/bump_test.go b/bump_test.go index 61308e5..aea8835 100644 --- a/bump_test.go +++ b/bump_test.go @@ -1,6 +1,7 @@ package bc import ( + "crypto/rand" "math" "testing" @@ -183,8 +184,38 @@ func TestOnlySpecifiedPathsStored(t *testing.T) { totalHashes += len(level) } // number of levels plus the txid itself. - l := int(math.Log2(float64(len(blockTxExample)))) + 1 + l := int(math.Ceil(math.Log2(float64(len(blockTxExample))))) + 1 require.Equal(t, l, totalHashes) } } + +func BenchmarkNewBUMPFromMerkleTreeAndIndex(b *testing.B) { + transactions := 100 + // test how quickly we can calculate the BUMP Merkle Paths from a block of 100,000 random txids + chainHashBlock := make([]*chainhash.Hash, 0) + for i := 0; i < transactions; i++ { + bytes := make([]byte, 32) + _, _ = rand.Read(bytes) + hash, err := chainhash.NewHash(bytes) + if err != nil { + b.Fatal(err) + } + chainHashBlock = append(chainHashBlock, hash) + } + merkles := BuildMerkleTreeStoreChainHash(chainHashBlock) + + b.ResetTimer() + + for idx := 0; idx < transactions; idx++ { + bump, err := NewBUMPFromMerkleTreeAndIndex(850000, merkles, uint64(idx)) + require.NoError(b, err) + totalHashes := 0 + for _, level := range bump.Path { + totalHashes += len(level) + } + // number of levels plus the txid itself. + l := int(math.Ceil(math.Log2(float64(transactions)))) + 1 + require.Equal(b, l, totalHashes) + } +} From 3087ba58479f4de057d4607c0d82d51c95a7eb75 Mon Sep 17 00:00:00 2001 From: Darren Kellenschwiler Date: Mon, 25 Mar 2024 14:09:00 -0500 Subject: [PATCH 3/8] 100,000 test benchmark Signed-off-by: Darren Kellenschwiler --- bump_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bump_test.go b/bump_test.go index aea8835..fa9453b 100644 --- a/bump_test.go +++ b/bump_test.go @@ -191,7 +191,7 @@ func TestOnlySpecifiedPathsStored(t *testing.T) { } func BenchmarkNewBUMPFromMerkleTreeAndIndex(b *testing.B) { - transactions := 100 + transactions := 100000 // test how quickly we can calculate the BUMP Merkle Paths from a block of 100,000 random txids chainHashBlock := make([]*chainhash.Hash, 0) for i := 0; i < transactions; i++ { From 85662bf9002dae6c02949e7fe308540f78fbaa4d Mon Sep 17 00:00:00 2001 From: Darren Kellenschwiler Date: Mon, 25 Mar 2024 14:39:18 -0500 Subject: [PATCH 4/8] further optimization Signed-off-by: Darren Kellenschwiler --- bump.go | 83 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/bump.go b/bump.go index b856001..5886539 100644 --- a/bump.go +++ b/bump.go @@ -219,61 +219,62 @@ func (bump *BUMP) CalculateRootGivenTxid(txid string) (string, error) { // NewBUMPFromMerkleTreeAndIndex with merkle tree we calculate the merkle path for a given transaction. func NewBUMPFromMerkleTreeAndIndex(blockHeight uint64, merkleTree []*chainhash.Hash, txIndex uint64) (*BUMP, error) { + if len(merkleTree) == 0 { + return nil, errors.New("merkle tree is empty") + } + bump := &BUMP{ BlockHeight: blockHeight, - Path: [][]leaf{}, } - t := true + truePointer := true txid := merkleTree[txIndex].String() - txidLeaf := leaf{Txid: &t, Hash: &txid, Offset: &txIndex} + txidLeaf := leaf{Txid: &truePointer, Hash: &txid, Offset: &txIndex} + + if len(merkleTree) == 1 { + // there is no merkle path to calculate + bump.Path = [][]leaf{{txidLeaf}} + return bump, nil + } + oddTxIndex := false numOfTxids := (len(merkleTree) + 1) / 2 treeHeight := int(math.Log2(float64(numOfTxids))) numOfHashes := numOfTxids + bump.Path = make([][]leaf, treeHeight) - switch len(merkleTree) { - case 0: - return nil, errors.New("merkle tree is empty") - case 1: - // if we have only one transaction in the block there is no merkle path to calculate - sh := merkleTree[0].String() - o := uint64(0) - bump.Path = [][]leaf{{leaf{Hash: &sh, Offset: &o, Txid: &t}}} - return bump, nil - default: - // if our hash index is odd the next hash of the path is the previous element in the array otherwise the next element. - levelOffset := 0 - for height := 0; height < treeHeight; height++ { - leaves := []leaf{} - bump.Path = append(bump.Path, leaves) - offset := txIndex >> uint64(height) - if offset&1 == 0 { - offset++ - } else { - oddTxIndex = true - offset-- - } - thisLeaf := leaf{Offset: &offset} - hash := merkleTree[levelOffset+int(offset)] - if hash.IsEqual(nil) { - thisLeaf.Duplicate = &t - } else { - sh := hash.String() - thisLeaf.Hash = &sh - } - bump.Path[height] = append(bump.Path[height], thisLeaf) - levelOffset += numOfHashes - numOfHashes >>= 1 + levelOffset := 0 + for height := 0; height < treeHeight; height++ { + leaves := []leaf{} + bump.Path = append(bump.Path, leaves) + offset := txIndex >> uint64(height) + if offset&1 == 0 { + // offset is even we need to use the hash to the right. + offset++ + } else { + // we need to use the hash to the left. + oddTxIndex = true + offset-- } - if oddTxIndex { - // if the txIndex is odd we need to add the txid to the path. - bump.Path[0] = append(bump.Path[0], txidLeaf) + thisLeaf := leaf{Offset: &offset} + hash := merkleTree[levelOffset+int(offset)] + if hash.IsEqual(nil) { + thisLeaf.Duplicate = &truePointer } else { - // otherwise prepend it. - bump.Path[0] = append([]leaf{txidLeaf}, bump.Path[0]...) + sh := hash.String() + thisLeaf.Hash = &sh } + bump.Path[height] = append(bump.Path[height], thisLeaf) + levelOffset += numOfHashes + numOfHashes >>= 1 + } + if oddTxIndex { + // if the txIndex is odd we need to add the txid to the path. + bump.Path[0] = append(bump.Path[0], txidLeaf) + } else { + // otherwise prepend it. + bump.Path[0] = append([]leaf{txidLeaf}, bump.Path[0]...) } return bump, nil From 73ed4325824110564e9123e54c216c34fa764372 Mon Sep 17 00:00:00 2001 From: Darren Kellenschwiler Date: Mon, 25 Mar 2024 15:03:18 -0500 Subject: [PATCH 5/8] remove some allocations for speed Signed-off-by: Darren Kellenschwiler --- bump.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bump.go b/bump.go index 5886539..afb90f5 100644 --- a/bump.go +++ b/bump.go @@ -246,8 +246,6 @@ func NewBUMPFromMerkleTreeAndIndex(blockHeight uint64, merkleTree []*chainhash.H levelOffset := 0 for height := 0; height < treeHeight; height++ { - leaves := []leaf{} - bump.Path = append(bump.Path, leaves) offset := txIndex >> uint64(height) if offset&1 == 0 { // offset is even we need to use the hash to the right. @@ -265,7 +263,7 @@ func NewBUMPFromMerkleTreeAndIndex(blockHeight uint64, merkleTree []*chainhash.H sh := hash.String() thisLeaf.Hash = &sh } - bump.Path[height] = append(bump.Path[height], thisLeaf) + bump.Path[height] = []leaf{thisLeaf} levelOffset += numOfHashes numOfHashes >>= 1 } From 817acf8b334181a607465d429538e132c106f668 Mon Sep 17 00:00:00 2001 From: Darren Kellenschwiler Date: Mon, 25 Mar 2024 15:08:06 -0500 Subject: [PATCH 6/8] deadline apparently not supported anymore Signed-off-by: Darren Kellenschwiler --- .github/workflows/run-tests.yml | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 1419eba..180cb26 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -23,7 +23,7 @@ jobs: with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: latest - args: --deadline=480s --skip-dirs=vendor --tests + args: --skip-dirs=vendor --tests build: strategy: matrix: diff --git a/Makefile b/Makefile index 693ec6c..efb5060 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ run-unit-tests-cover: open file:///$(shell pwd)/cover.html run-linter: - @golangci-lint run --deadline=480s --skip-dirs=vendor --tests + @golangci-lint run --skip-dirs=vendor --tests install-linter: @curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)bin v1.45.2 From 2a3ec149ba315585b47063c713f95acdb3f54b89 Mon Sep 17 00:00:00 2001 From: Darren Kellenschwiler Date: Mon, 25 Mar 2024 15:13:29 -0500 Subject: [PATCH 7/8] skip dirs not allowed either? Signed-off-by: Darren Kellenschwiler --- .github/workflows/run-tests.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 180cb26..3cb2ded 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -21,9 +21,8 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v2 with: - # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: latest - args: --skip-dirs=vendor --tests + args: --tests build: strategy: matrix: @@ -54,6 +53,6 @@ jobs: if: startsWith(github.ref, 'refs/tags/') with: version: latest - args: release --clean + args: release --rm-dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From ef529224c92a12b57e36e643545d9d3b81525631 Mon Sep 17 00:00:00 2001 From: Darren Kellenschwiler Date: Mon, 25 Mar 2024 15:19:22 -0500 Subject: [PATCH 8/8] linter complaint resolved. Signed-off-by: Darren Kellenschwiler --- spv/create_ancestry_test.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/spv/create_ancestry_test.go b/spv/create_ancestry_test.go index 59921fc..ced2ac9 100644 --- a/spv/create_ancestry_test.go +++ b/spv/create_ancestry_test.go @@ -48,7 +48,7 @@ func TestSPVEnvelope_CreateEnvelope(t *testing.T) { }{ "valid ancestry created": { tx: "0200000005c931fb0af1eedc1fcb1c00171c80fcdef48564d3a8582dd530a9ba258497b1ea000000006a473044022011dd49f90eb34195e61712cef41d16ce9496807124b1e1c6205cb06ccfdbef0002203b2553032d166724d89a42a12b997cb1c4a78c4d8bbc72f94ab9ef4c3db36d38412103f6e8ebb2836f89aedbe712fa91eda827df597a01fe1a19fa1658bc1d28d1ad15feffffffc931fb0af1eedc1fcb1c00171c80fcdef48564d3a8582dd530a9ba258497b1ea010000006b483045022100f8a92d8e09a239d863b57c44fd2915558afbe05074c992b72639288f15a5a928022047399d49fcc7354140ecec229fe682383a9e9c59e43da368d35d211a06a17f2641210363d67968518ee1c0485b9b95544c0a9ec8c280b649b72c74fe86c299cd055a3bfeffffff250d555b731c8ba2843781d812f1aefbad643665864f29eef18f0b65b77ca9a7010000006b483045022100ece110a2ae06c67f3d4b25ad4ec2d7acf85fa1618dabef9d7eed5b4e5c50bbea02207716c2a9dd8d1ce64a56a3377eb35892db42dbba62058ebeb1b14ca33a8b98c241210241f2c990d7e0fe5c1c5e4508883b76b9786fcc67ccee1b8724eefa89a8f32981feffffff4713da1eacb49f37bd414205706229ddd8a85639a864c063fd2fd1a943ee1569010000006b483045022100831aac063f1b32f9e5645c5442a6b15cb620c6c49930f0194fa6acf6c864f48202203a8cc93d8bcd6f7d86cac0c7c99485cc1837fc87790f13f5bbf2f3b901e86be341210376c2519a09f7cfbcbe000f823c1e957cadace64296e907ae1ea36536313f0706feffffffcb551ea63f1903d74888a1f8989fb521df1567740a0edcf862fbd4f372783236010000006b483045022100f0fa4ab61952f5497d4dfe6b7a4e5e9b3305a5b94b0d7a6d1536927dfea2aa4202205eaa36045812bf5561c9e3a38fc92e6d89908637a5c0ec250a843f36355418c2412103f6e8ebb2836f89aedbe712fa91eda827df597a01fe1a19fa1658bc1d28d1ad15feffffff02bccdf505000000001976a914349256bff9dbe79285454d0e55d1a3163bd6dff888ac0084d717000000001976a914e2e4d329a79401e0a713210a4c615abdc540eda888ac68000000", - txFunc: func(ctx context.Context, txID string) (*bt.Tx, error) { + txFunc: func(_ context.Context, txID string) (*bt.Tx, error) { switch txID { case "eab1978425baa930d52d58a8d36485f4defc801c17001ccb1fdceef10afb31c9": return bt.NewTxFromString("02000000022082b13cb07c06d360773aca3ee9fe8bc5d73f8ad0e3698cc2e23e83bc2f3dc1000000006b483045022100a5c4b36223100189519957f41ae4ec345e4e2782f567d46504c4a432e523b34802203598789197f91e06a136e7dd16e163669de3b03123497f6d8a9a266be975a4df412103f6e8ebb2836f89aedbe712fa91eda827df597a01fe1a19fa1658bc1d28d1ad15feffffff4bcbb7ca743245103b7c31c75845acfbe7ecaa62b90728fd3d9d0da81b0f5549010000006a473044022007a2fc274ace708d919fcd79ac134f8acf47a9ce6e10795e1c6a51548684ea9e022017cd7982c3b86bf874b3aaaa5324241b415fc4c299463b072074bdbac367ef8c412103f6e8ebb2836f89aedbe712fa91eda827df597a01fe1a19fa1658bc1d28d1ad15feffffff0200e1f505000000001976a914b9be6c0240ce6137722a5ef28121d5967ce1049f88ac8adff505000000001976a914863189af8516a85b2a12db0119540070c977a18288ac67000000") @@ -62,7 +62,7 @@ func TestSPVEnvelope_CreateEnvelope(t *testing.T) { return nil, fmt.Errorf("txid %s not defined for test", txID) } }, - mpFunc: func(ctx context.Context, txID string) (*bc.MerkleProof, error) { + mpFunc: func(_ context.Context, txID string) (*bc.MerkleProof, error) { mp, ok := map[string]*bc.MerkleProof{ "2a65d19f8d29ce53beb0f0e636a1d7b368d5c87b67cd3164277a7d29b66a636e": nil, "eab1978425baa930d52d58a8d36485f4defc801c17001ccb1fdceef10afb31c9": { @@ -119,7 +119,7 @@ func TestSPVEnvelope_CreateEnvelope(t *testing.T) { }, "creating an ancestry with tx that doesn't exist errors": { tx: "0200000005c931fb0af1eedc1fcb1c00171c80fcdef48564d3a8582dd530a9ba258497b1ea000000006a473044022011dd49f90eb34195e61712cef41d16ce9496807124b1e1c6205cb06ccfdbef0002203b2553032d166724d89a42a12b997cb1c4a78c4d8bbc72f94ab9ef4c3db36d38412103f6e8ebb2836f89aedbe712fa91eda827df597a01fe1a19fa1658bc1d28d1ad15feffffffc931fb0af1eedc1fcb1c00171c80fcdef48564d3a8582dd530a9ba258497b1ea010000006b483045022100f8a92d8e09a239d863b57c44fd2915558afbe05074c992b72639288f15a5a928022047399d49fcc7354140ecec229fe682383a9e9c59e43da368d35d211a06a17f2641210363d67968518ee1c0485b9b95544c0a9ec8c280b649b72c74fe86c299cd055a3bfeffffff250d555b731c8ba2843781d812f1aefbad643665864f29eef18f0b65b77ca9a7010000006b483045022100ece110a2ae06c67f3d4b25ad4ec2d7acf85fa1618dabef9d7eed5b4e5c50bbea02207716c2a9dd8d1ce64a56a3377eb35892db42dbba62058ebeb1b14ca33a8b98c241210241f2c990d7e0fe5c1c5e4508883b76b9786fcc67ccee1b8724eefa89a8f32981feffffff4713da1eacb49f37bd414205706229ddd8a85639a864c063fd2fd1a943ee1569010000006b483045022100831aac063f1b32f9e5645c5442a6b15cb620c6c49930f0194fa6acf6c864f48202203a8cc93d8bcd6f7d86cac0c7c99485cc1837fc87790f13f5bbf2f3b901e86be341210376c2519a09f7cfbcbe000f823c1e957cadace64296e907ae1ea36536313f0706feffffffcb551ea63f1903d74888a1f8989fb521df1567740a0edcf862fbd4f372783236010000006b483045022100f0fa4ab61952f5497d4dfe6b7a4e5e9b3305a5b94b0d7a6d1536927dfea2aa4202205eaa36045812bf5561c9e3a38fc92e6d89908637a5c0ec250a843f36355418c2412103f6e8ebb2836f89aedbe712fa91eda827df597a01fe1a19fa1658bc1d28d1ad15feffffff02bccdf505000000001976a914349256bff9dbe79285454d0e55d1a3163bd6dff888ac0084d717000000001976a914e2e4d329a79401e0a713210a4c615abdc540eda888ac68000000", - txFunc: func(ctx context.Context, txID string) (*bt.Tx, error) { + txFunc: func(_ context.Context, txID string) (*bt.Tx, error) { switch txID { case "eab1978425baa930d52d58a8d36485f4defc801c17001ccb1fdceef10afb31c9": return bt.NewTxFromString("02000000022082b13cb07c06d360773aca3ee9fe8bc5d73f8ad0e3698cc2e23e83bc2f3dc1000000006b483045022100a5c4b36223100189519957f41ae4ec345e4e2782f567d46504c4a432e523b34802203598789197f91e06a136e7dd16e163669de3b03123497f6d8a9a266be975a4df412103f6e8ebb2836f89aedbe712fa91eda827df597a01fe1a19fa1658bc1d28d1ad15feffffff4bcbb7ca743245103b7c31c75845acfbe7ecaa62b90728fd3d9d0da81b0f5549010000006a473044022007a2fc274ace708d919fcd79ac134f8acf47a9ce6e10795e1c6a51548684ea9e022017cd7982c3b86bf874b3aaaa5324241b415fc4c299463b072074bdbac367ef8c412103f6e8ebb2836f89aedbe712fa91eda827df597a01fe1a19fa1658bc1d28d1ad15feffffff0200e1f505000000001976a914b9be6c0240ce6137722a5ef28121d5967ce1049f88ac8adff505000000001976a914863189af8516a85b2a12db0119540070c977a18288ac67000000") @@ -133,7 +133,7 @@ func TestSPVEnvelope_CreateEnvelope(t *testing.T) { return nil, fmt.Errorf("txid %s not defined for test", txID) } }, - mpFunc: func(ctx context.Context, txID string) (*bc.MerkleProof, error) { + mpFunc: func(_ context.Context, txID string) (*bc.MerkleProof, error) { mp, ok := map[string]*bc.MerkleProof{ "2a65d19f8d29ce53beb0f0e636a1d7b368d5c87b67cd3164277a7d29b66a636e": nil, "eab1978425baa930d52d58a8d36485f4defc801c17001ccb1fdceef10afb31c9": { @@ -190,7 +190,7 @@ func TestSPVEnvelope_CreateEnvelope(t *testing.T) { }, "error when getting tx is handled": { tx: "0200000005c931fb0af1eedc1fcb1c00171c80fcdef48564d3a8582dd530a9ba258497b1ea000000006a473044022011dd49f90eb34195e61712cef41d16ce9496807124b1e1c6205cb06ccfdbef0002203b2553032d166724d89a42a12b997cb1c4a78c4d8bbc72f94ab9ef4c3db36d38412103f6e8ebb2836f89aedbe712fa91eda827df597a01fe1a19fa1658bc1d28d1ad15feffffffc931fb0af1eedc1fcb1c00171c80fcdef48564d3a8582dd530a9ba258497b1ea010000006b483045022100f8a92d8e09a239d863b57c44fd2915558afbe05074c992b72639288f15a5a928022047399d49fcc7354140ecec229fe682383a9e9c59e43da368d35d211a06a17f2641210363d67968518ee1c0485b9b95544c0a9ec8c280b649b72c74fe86c299cd055a3bfeffffff250d555b731c8ba2843781d812f1aefbad643665864f29eef18f0b65b77ca9a7010000006b483045022100ece110a2ae06c67f3d4b25ad4ec2d7acf85fa1618dabef9d7eed5b4e5c50bbea02207716c2a9dd8d1ce64a56a3377eb35892db42dbba62058ebeb1b14ca33a8b98c241210241f2c990d7e0fe5c1c5e4508883b76b9786fcc67ccee1b8724eefa89a8f32981feffffff4713da1eacb49f37bd414205706229ddd8a85639a864c063fd2fd1a943ee1569010000006b483045022100831aac063f1b32f9e5645c5442a6b15cb620c6c49930f0194fa6acf6c864f48202203a8cc93d8bcd6f7d86cac0c7c99485cc1837fc87790f13f5bbf2f3b901e86be341210376c2519a09f7cfbcbe000f823c1e957cadace64296e907ae1ea36536313f0706feffffffcb551ea63f1903d74888a1f8989fb521df1567740a0edcf862fbd4f372783236010000006b483045022100f0fa4ab61952f5497d4dfe6b7a4e5e9b3305a5b94b0d7a6d1536927dfea2aa4202205eaa36045812bf5561c9e3a38fc92e6d89908637a5c0ec250a843f36355418c2412103f6e8ebb2836f89aedbe712fa91eda827df597a01fe1a19fa1658bc1d28d1ad15feffffff02bccdf505000000001976a914349256bff9dbe79285454d0e55d1a3163bd6dff888ac0084d717000000001976a914e2e4d329a79401e0a713210a4c615abdc540eda888ac68000000", - txFunc: func(ctx context.Context, txID string) (*bt.Tx, error) { + txFunc: func(_ context.Context, txID string) (*bt.Tx, error) { switch txID { case "eab1978425baa930d52d58a8d36485f4defc801c17001ccb1fdceef10afb31c9": return bt.NewTxFromString("02000000022082b13cb07c06d360773aca3ee9fe8bc5d73f8ad0e3698cc2e23e83bc2f3dc1000000006b483045022100a5c4b36223100189519957f41ae4ec345e4e2782f567d46504c4a432e523b34802203598789197f91e06a136e7dd16e163669de3b03123497f6d8a9a266be975a4df412103f6e8ebb2836f89aedbe712fa91eda827df597a01fe1a19fa1658bc1d28d1ad15feffffff4bcbb7ca743245103b7c31c75845acfbe7ecaa62b90728fd3d9d0da81b0f5549010000006a473044022007a2fc274ace708d919fcd79ac134f8acf47a9ce6e10795e1c6a51548684ea9e022017cd7982c3b86bf874b3aaaa5324241b415fc4c299463b072074bdbac367ef8c412103f6e8ebb2836f89aedbe712fa91eda827df597a01fe1a19fa1658bc1d28d1ad15feffffff0200e1f505000000001976a914b9be6c0240ce6137722a5ef28121d5967ce1049f88ac8adff505000000001976a914863189af8516a85b2a12db0119540070c977a18288ac67000000") @@ -202,7 +202,7 @@ func TestSPVEnvelope_CreateEnvelope(t *testing.T) { return nil, fmt.Errorf("txid %s not defined for test", txID) } }, - mpFunc: func(ctx context.Context, txID string) (*bc.MerkleProof, error) { + mpFunc: func(_ context.Context, txID string) (*bc.MerkleProof, error) { mp, ok := map[string]*bc.MerkleProof{ "2a65d19f8d29ce53beb0f0e636a1d7b368d5c87b67cd3164277a7d29b66a636e": nil, "eab1978425baa930d52d58a8d36485f4defc801c17001ccb1fdceef10afb31c9": { @@ -259,7 +259,7 @@ func TestSPVEnvelope_CreateEnvelope(t *testing.T) { }, "error when getting merkle proof is handled": { tx: "0200000005c931fb0af1eedc1fcb1c00171c80fcdef48564d3a8582dd530a9ba258497b1ea000000006a473044022011dd49f90eb34195e61712cef41d16ce9496807124b1e1c6205cb06ccfdbef0002203b2553032d166724d89a42a12b997cb1c4a78c4d8bbc72f94ab9ef4c3db36d38412103f6e8ebb2836f89aedbe712fa91eda827df597a01fe1a19fa1658bc1d28d1ad15feffffffc931fb0af1eedc1fcb1c00171c80fcdef48564d3a8582dd530a9ba258497b1ea010000006b483045022100f8a92d8e09a239d863b57c44fd2915558afbe05074c992b72639288f15a5a928022047399d49fcc7354140ecec229fe682383a9e9c59e43da368d35d211a06a17f2641210363d67968518ee1c0485b9b95544c0a9ec8c280b649b72c74fe86c299cd055a3bfeffffff250d555b731c8ba2843781d812f1aefbad643665864f29eef18f0b65b77ca9a7010000006b483045022100ece110a2ae06c67f3d4b25ad4ec2d7acf85fa1618dabef9d7eed5b4e5c50bbea02207716c2a9dd8d1ce64a56a3377eb35892db42dbba62058ebeb1b14ca33a8b98c241210241f2c990d7e0fe5c1c5e4508883b76b9786fcc67ccee1b8724eefa89a8f32981feffffff4713da1eacb49f37bd414205706229ddd8a85639a864c063fd2fd1a943ee1569010000006b483045022100831aac063f1b32f9e5645c5442a6b15cb620c6c49930f0194fa6acf6c864f48202203a8cc93d8bcd6f7d86cac0c7c99485cc1837fc87790f13f5bbf2f3b901e86be341210376c2519a09f7cfbcbe000f823c1e957cadace64296e907ae1ea36536313f0706feffffffcb551ea63f1903d74888a1f8989fb521df1567740a0edcf862fbd4f372783236010000006b483045022100f0fa4ab61952f5497d4dfe6b7a4e5e9b3305a5b94b0d7a6d1536927dfea2aa4202205eaa36045812bf5561c9e3a38fc92e6d89908637a5c0ec250a843f36355418c2412103f6e8ebb2836f89aedbe712fa91eda827df597a01fe1a19fa1658bc1d28d1ad15feffffff02bccdf505000000001976a914349256bff9dbe79285454d0e55d1a3163bd6dff888ac0084d717000000001976a914e2e4d329a79401e0a713210a4c615abdc540eda888ac68000000", - txFunc: func(ctx context.Context, txID string) (*bt.Tx, error) { + txFunc: func(_ context.Context, txID string) (*bt.Tx, error) { switch txID { case "eab1978425baa930d52d58a8d36485f4defc801c17001ccb1fdceef10afb31c9": return bt.NewTxFromString("02000000022082b13cb07c06d360773aca3ee9fe8bc5d73f8ad0e3698cc2e23e83bc2f3dc1000000006b483045022100a5c4b36223100189519957f41ae4ec345e4e2782f567d46504c4a432e523b34802203598789197f91e06a136e7dd16e163669de3b03123497f6d8a9a266be975a4df412103f6e8ebb2836f89aedbe712fa91eda827df597a01fe1a19fa1658bc1d28d1ad15feffffff4bcbb7ca743245103b7c31c75845acfbe7ecaa62b90728fd3d9d0da81b0f5549010000006a473044022007a2fc274ace708d919fcd79ac134f8acf47a9ce6e10795e1c6a51548684ea9e022017cd7982c3b86bf874b3aaaa5324241b415fc4c299463b072074bdbac367ef8c412103f6e8ebb2836f89aedbe712fa91eda827df597a01fe1a19fa1658bc1d28d1ad15feffffff0200e1f505000000001976a914b9be6c0240ce6137722a5ef28121d5967ce1049f88ac8adff505000000001976a914863189af8516a85b2a12db0119540070c977a18288ac67000000") @@ -273,7 +273,7 @@ func TestSPVEnvelope_CreateEnvelope(t *testing.T) { return nil, fmt.Errorf("txid %s not defined for test", txID) } }, - mpFunc: func(ctx context.Context, txID string) (*bc.MerkleProof, error) { + mpFunc: func(_ context.Context, txID string) (*bc.MerkleProof, error) { if txID == "a7a97cb7650b8ff1ee294f86653664adfbaef112d8813784a28b1c735b550d25" { return nil, errors.New("bigger badder error") } @@ -322,7 +322,7 @@ func TestSPVEnvelope_CreateEnvelope(t *testing.T) { }, "ancestry needing multiple layers can be built": { tx: "02000000054e5113bf8330981b4f063d95d18540bc09016843347437ace0133f27c830a518000000006a47304402204455d7f4e1ccf6c8aa47e7b99349e02aadc80474e3c8b9b479d2d5aa98eb954402206a3ac9cc086bb03cb4a9db872fbb46d682f1036dd5e51d910484d62651eaad124121024d62a2e85bd2c310a2a43b2f17e4312381209276424fb634bd89325068997091feffffff531d1d4246046ad2e67636965b682509d0d021badf1ed95177b2e27a80e2020a000000006b483045022100a0882e9db7ff299178211b7223ee891119d22374c8e2ce21aec00daaad5e170102207af1d17b4d9ed4f9684e520f709239fded50f3ea7d5ec7a9e458ab00a2efffea412102e9fab6eb7648af9cd3719224062bfec10863ea9ba7a2caf26384705bc4387569feffffff531d1d4246046ad2e67636965b682509d0d021badf1ed95177b2e27a80e2020a010000006b483045022100b1d5b94ce9b5a1c8b531757aff4439bfb426dc439c3e35f6cdc3a08c9657ea0c02203c8490252d52db4557032042a5dcc8c3a2cdd9378dfd38f5ca03a9940ca055a2412103b05c23dcb06d192490d83c39bfbb515dfd0c0c172ae9314c91824b8936459132feffffffcd6b25094891d60413d5b50a4f6309574d648b9af6dbe782aa3510b18a0759fa010000006b483045022100bda388d23ccbea1beb3b1b55387600ae1b54759844beca4e9bcd405c2665b1a902206e536756978ffc3812c12f6eeeb82de351e13ad70d9e93c2358eb8a3c315330d4121024d62a2e85bd2c310a2a43b2f17e4312381209276424fb634bd89325068997091feffffff99995c0c19cda01cec64b7e20a3df37920bd3ad1ba6e666e337cb37d7829b354000000006a47304402205d6ebce84aeaf337c81894ffce89cc21a59a8659d07a599bb3371e5fee89153c02204432f8fae576e0aa47122d2dfbc914a6a34813fba86ecd0fcf0dd7ca65d199df4121034fc957d2e5b7299624148b914e830c763532983979c4cb3df29cca2751982d9afeffffff0282c3f505000000001976a9147fcac6c6eabf96ea58e561d3880f8e68bc58574088ac0027b929000000001976a9142d58ec9527c3df1ada4cac18cde85beb57cb199588ac68000000", - txFunc: func(ctx context.Context, txID string) (*bt.Tx, error) { + txFunc: func(_ context.Context, txID string) (*bt.Tx, error) { switch txID { case "18a530c8273f13e0ac37743443680109bc4085d1953d064f1b983083bf13514e": return bt.NewTxFromString("0200000002703e994d4a81999de279c58d82f6aaa796bbba3d2da965fa99188067bf9d6606010000006b483045022100f1db569063675b18f1684db90294594931b82de72787878da2c9f628344d536102203efa439af8cc4725edb18c3f707a10ef9f5bb7dc46bd8ff35590312058f428274121024d62a2e85bd2c310a2a43b2f17e4312381209276424fb634bd89325068997091feffffffcd6b25094891d60413d5b50a4f6309574d648b9af6dbe782aa3510b18a0759fa000000006a4730440220023d6e7295e0e3e6aca2a56a9295e65dfb09f0e39b68ee81a10c13d24575414f022043cc1a6c1a7ce20a7b200ea26f77c590030a9400a55ca175ceef42471ba44227412102cf9a3a9e474debf4a369c6fcb01a630b0d137bc7044c559f49bedc5c12ee1440feffffff0200e1f505000000001976a914710b36a8bb8db72b23d1bcfe60f83b7ef1b9f60088ac78cff505000000001976a914e534d5ca3fb18b6b715840da7700da5957ffaa6d88ac65000000") @@ -355,7 +355,7 @@ func TestSPVEnvelope_CreateEnvelope(t *testing.T) { } return nil, fmt.Errorf("tx %s not defined for test", txID) }, - mpFunc: func(ctx context.Context, txID string) (*bc.MerkleProof, error) { + mpFunc: func(_ context.Context, txID string) (*bc.MerkleProof, error) { mp, ok := map[string]*bc.MerkleProof{ "18a530c8273f13e0ac37743443680109bc4085d1953d064f1b983083bf13514e": nil, "06669dbf67801899fa65a92d3dbabb96a7aaf6828dc579e29d99814a4d993e70": nil, @@ -442,7 +442,7 @@ func TestSPVEnvelope_CreateEnvelope(t *testing.T) { }, "missing tx multiple layers down causes error": { tx: "02000000054e5113bf8330981b4f063d95d18540bc09016843347437ace0133f27c830a518000000006a47304402204455d7f4e1ccf6c8aa47e7b99349e02aadc80474e3c8b9b479d2d5aa98eb954402206a3ac9cc086bb03cb4a9db872fbb46d682f1036dd5e51d910484d62651eaad124121024d62a2e85bd2c310a2a43b2f17e4312381209276424fb634bd89325068997091feffffff531d1d4246046ad2e67636965b682509d0d021badf1ed95177b2e27a80e2020a000000006b483045022100a0882e9db7ff299178211b7223ee891119d22374c8e2ce21aec00daaad5e170102207af1d17b4d9ed4f9684e520f709239fded50f3ea7d5ec7a9e458ab00a2efffea412102e9fab6eb7648af9cd3719224062bfec10863ea9ba7a2caf26384705bc4387569feffffff531d1d4246046ad2e67636965b682509d0d021badf1ed95177b2e27a80e2020a010000006b483045022100b1d5b94ce9b5a1c8b531757aff4439bfb426dc439c3e35f6cdc3a08c9657ea0c02203c8490252d52db4557032042a5dcc8c3a2cdd9378dfd38f5ca03a9940ca055a2412103b05c23dcb06d192490d83c39bfbb515dfd0c0c172ae9314c91824b8936459132feffffffcd6b25094891d60413d5b50a4f6309574d648b9af6dbe782aa3510b18a0759fa010000006b483045022100bda388d23ccbea1beb3b1b55387600ae1b54759844beca4e9bcd405c2665b1a902206e536756978ffc3812c12f6eeeb82de351e13ad70d9e93c2358eb8a3c315330d4121024d62a2e85bd2c310a2a43b2f17e4312381209276424fb634bd89325068997091feffffff99995c0c19cda01cec64b7e20a3df37920bd3ad1ba6e666e337cb37d7829b354000000006a47304402205d6ebce84aeaf337c81894ffce89cc21a59a8659d07a599bb3371e5fee89153c02204432f8fae576e0aa47122d2dfbc914a6a34813fba86ecd0fcf0dd7ca65d199df4121034fc957d2e5b7299624148b914e830c763532983979c4cb3df29cca2751982d9afeffffff0282c3f505000000001976a9147fcac6c6eabf96ea58e561d3880f8e68bc58574088ac0027b929000000001976a9142d58ec9527c3df1ada4cac18cde85beb57cb199588ac68000000", - txFunc: func(ctx context.Context, txID string) (*bt.Tx, error) { + txFunc: func(_ context.Context, txID string) (*bt.Tx, error) { switch txID { case "18a530c8273f13e0ac37743443680109bc4085d1953d064f1b983083bf13514e": return bt.NewTxFromString("0200000002703e994d4a81999de279c58d82f6aaa796bbba3d2da965fa99188067bf9d6606010000006b483045022100f1db569063675b18f1684db90294594931b82de72787878da2c9f628344d536102203efa439af8cc4725edb18c3f707a10ef9f5bb7dc46bd8ff35590312058f428274121024d62a2e85bd2c310a2a43b2f17e4312381209276424fb634bd89325068997091feffffffcd6b25094891d60413d5b50a4f6309574d648b9af6dbe782aa3510b18a0759fa000000006a4730440220023d6e7295e0e3e6aca2a56a9295e65dfb09f0e39b68ee81a10c13d24575414f022043cc1a6c1a7ce20a7b200ea26f77c590030a9400a55ca175ceef42471ba44227412102cf9a3a9e474debf4a369c6fcb01a630b0d137bc7044c559f49bedc5c12ee1440feffffff0200e1f505000000001976a914710b36a8bb8db72b23d1bcfe60f83b7ef1b9f60088ac78cff505000000001976a914e534d5ca3fb18b6b715840da7700da5957ffaa6d88ac65000000") @@ -475,7 +475,7 @@ func TestSPVEnvelope_CreateEnvelope(t *testing.T) { } return nil, fmt.Errorf("tx %s not defined for test", txID) }, - mpFunc: func(ctx context.Context, txID string) (*bc.MerkleProof, error) { + mpFunc: func(_ context.Context, txID string) (*bc.MerkleProof, error) { mp, ok := map[string]*bc.MerkleProof{ "18a530c8273f13e0ac37743443680109bc4085d1953d064f1b983083bf13514e": nil, "06669dbf67801899fa65a92d3dbabb96a7aaf6828dc579e29d99814a4d993e70": nil, @@ -562,7 +562,7 @@ func TestSPVEnvelope_CreateEnvelope(t *testing.T) { }, "error getting tx multiple layers down is handled": { tx: "02000000054e5113bf8330981b4f063d95d18540bc09016843347437ace0133f27c830a518000000006a47304402204455d7f4e1ccf6c8aa47e7b99349e02aadc80474e3c8b9b479d2d5aa98eb954402206a3ac9cc086bb03cb4a9db872fbb46d682f1036dd5e51d910484d62651eaad124121024d62a2e85bd2c310a2a43b2f17e4312381209276424fb634bd89325068997091feffffff531d1d4246046ad2e67636965b682509d0d021badf1ed95177b2e27a80e2020a000000006b483045022100a0882e9db7ff299178211b7223ee891119d22374c8e2ce21aec00daaad5e170102207af1d17b4d9ed4f9684e520f709239fded50f3ea7d5ec7a9e458ab00a2efffea412102e9fab6eb7648af9cd3719224062bfec10863ea9ba7a2caf26384705bc4387569feffffff531d1d4246046ad2e67636965b682509d0d021badf1ed95177b2e27a80e2020a010000006b483045022100b1d5b94ce9b5a1c8b531757aff4439bfb426dc439c3e35f6cdc3a08c9657ea0c02203c8490252d52db4557032042a5dcc8c3a2cdd9378dfd38f5ca03a9940ca055a2412103b05c23dcb06d192490d83c39bfbb515dfd0c0c172ae9314c91824b8936459132feffffffcd6b25094891d60413d5b50a4f6309574d648b9af6dbe782aa3510b18a0759fa010000006b483045022100bda388d23ccbea1beb3b1b55387600ae1b54759844beca4e9bcd405c2665b1a902206e536756978ffc3812c12f6eeeb82de351e13ad70d9e93c2358eb8a3c315330d4121024d62a2e85bd2c310a2a43b2f17e4312381209276424fb634bd89325068997091feffffff99995c0c19cda01cec64b7e20a3df37920bd3ad1ba6e666e337cb37d7829b354000000006a47304402205d6ebce84aeaf337c81894ffce89cc21a59a8659d07a599bb3371e5fee89153c02204432f8fae576e0aa47122d2dfbc914a6a34813fba86ecd0fcf0dd7ca65d199df4121034fc957d2e5b7299624148b914e830c763532983979c4cb3df29cca2751982d9afeffffff0282c3f505000000001976a9147fcac6c6eabf96ea58e561d3880f8e68bc58574088ac0027b929000000001976a9142d58ec9527c3df1ada4cac18cde85beb57cb199588ac68000000", - txFunc: func(ctx context.Context, txID string) (*bt.Tx, error) { + txFunc: func(_ context.Context, txID string) (*bt.Tx, error) { switch txID { case "18a530c8273f13e0ac37743443680109bc4085d1953d064f1b983083bf13514e": return bt.NewTxFromString("0200000002703e994d4a81999de279c58d82f6aaa796bbba3d2da965fa99188067bf9d6606010000006b483045022100f1db569063675b18f1684db90294594931b82de72787878da2c9f628344d536102203efa439af8cc4725edb18c3f707a10ef9f5bb7dc46bd8ff35590312058f428274121024d62a2e85bd2c310a2a43b2f17e4312381209276424fb634bd89325068997091feffffffcd6b25094891d60413d5b50a4f6309574d648b9af6dbe782aa3510b18a0759fa000000006a4730440220023d6e7295e0e3e6aca2a56a9295e65dfb09f0e39b68ee81a10c13d24575414f022043cc1a6c1a7ce20a7b200ea26f77c590030a9400a55ca175ceef42471ba44227412102cf9a3a9e474debf4a369c6fcb01a630b0d137bc7044c559f49bedc5c12ee1440feffffff0200e1f505000000001976a914710b36a8bb8db72b23d1bcfe60f83b7ef1b9f60088ac78cff505000000001976a914e534d5ca3fb18b6b715840da7700da5957ffaa6d88ac65000000") @@ -595,7 +595,7 @@ func TestSPVEnvelope_CreateEnvelope(t *testing.T) { } return nil, fmt.Errorf("tx %s not defined for test", txID) }, - mpFunc: func(ctx context.Context, txID string) (*bc.MerkleProof, error) { + mpFunc: func(_ context.Context, txID string) (*bc.MerkleProof, error) { mp, ok := map[string]*bc.MerkleProof{ "18a530c8273f13e0ac37743443680109bc4085d1953d064f1b983083bf13514e": nil, "06669dbf67801899fa65a92d3dbabb96a7aaf6828dc579e29d99814a4d993e70": nil, @@ -682,7 +682,7 @@ func TestSPVEnvelope_CreateEnvelope(t *testing.T) { }, "error getting merkle proof multiple layers down is handled": { tx: "02000000054e5113bf8330981b4f063d95d18540bc09016843347437ace0133f27c830a518000000006a47304402204455d7f4e1ccf6c8aa47e7b99349e02aadc80474e3c8b9b479d2d5aa98eb954402206a3ac9cc086bb03cb4a9db872fbb46d682f1036dd5e51d910484d62651eaad124121024d62a2e85bd2c310a2a43b2f17e4312381209276424fb634bd89325068997091feffffff531d1d4246046ad2e67636965b682509d0d021badf1ed95177b2e27a80e2020a000000006b483045022100a0882e9db7ff299178211b7223ee891119d22374c8e2ce21aec00daaad5e170102207af1d17b4d9ed4f9684e520f709239fded50f3ea7d5ec7a9e458ab00a2efffea412102e9fab6eb7648af9cd3719224062bfec10863ea9ba7a2caf26384705bc4387569feffffff531d1d4246046ad2e67636965b682509d0d021badf1ed95177b2e27a80e2020a010000006b483045022100b1d5b94ce9b5a1c8b531757aff4439bfb426dc439c3e35f6cdc3a08c9657ea0c02203c8490252d52db4557032042a5dcc8c3a2cdd9378dfd38f5ca03a9940ca055a2412103b05c23dcb06d192490d83c39bfbb515dfd0c0c172ae9314c91824b8936459132feffffffcd6b25094891d60413d5b50a4f6309574d648b9af6dbe782aa3510b18a0759fa010000006b483045022100bda388d23ccbea1beb3b1b55387600ae1b54759844beca4e9bcd405c2665b1a902206e536756978ffc3812c12f6eeeb82de351e13ad70d9e93c2358eb8a3c315330d4121024d62a2e85bd2c310a2a43b2f17e4312381209276424fb634bd89325068997091feffffff99995c0c19cda01cec64b7e20a3df37920bd3ad1ba6e666e337cb37d7829b354000000006a47304402205d6ebce84aeaf337c81894ffce89cc21a59a8659d07a599bb3371e5fee89153c02204432f8fae576e0aa47122d2dfbc914a6a34813fba86ecd0fcf0dd7ca65d199df4121034fc957d2e5b7299624148b914e830c763532983979c4cb3df29cca2751982d9afeffffff0282c3f505000000001976a9147fcac6c6eabf96ea58e561d3880f8e68bc58574088ac0027b929000000001976a9142d58ec9527c3df1ada4cac18cde85beb57cb199588ac68000000", - txFunc: func(ctx context.Context, txID string) (*bt.Tx, error) { + txFunc: func(_ context.Context, txID string) (*bt.Tx, error) { switch txID { case "18a530c8273f13e0ac37743443680109bc4085d1953d064f1b983083bf13514e": return bt.NewTxFromString("0200000002703e994d4a81999de279c58d82f6aaa796bbba3d2da965fa99188067bf9d6606010000006b483045022100f1db569063675b18f1684db90294594931b82de72787878da2c9f628344d536102203efa439af8cc4725edb18c3f707a10ef9f5bb7dc46bd8ff35590312058f428274121024d62a2e85bd2c310a2a43b2f17e4312381209276424fb634bd89325068997091feffffffcd6b25094891d60413d5b50a4f6309574d648b9af6dbe782aa3510b18a0759fa000000006a4730440220023d6e7295e0e3e6aca2a56a9295e65dfb09f0e39b68ee81a10c13d24575414f022043cc1a6c1a7ce20a7b200ea26f77c590030a9400a55ca175ceef42471ba44227412102cf9a3a9e474debf4a369c6fcb01a630b0d137bc7044c559f49bedc5c12ee1440feffffff0200e1f505000000001976a914710b36a8bb8db72b23d1bcfe60f83b7ef1b9f60088ac78cff505000000001976a914e534d5ca3fb18b6b715840da7700da5957ffaa6d88ac65000000") @@ -715,7 +715,7 @@ func TestSPVEnvelope_CreateEnvelope(t *testing.T) { } return nil, fmt.Errorf("tx %s not defined for test", txID) }, - mpFunc: func(ctx context.Context, txID string) (*bc.MerkleProof, error) { + mpFunc: func(_ context.Context, txID string) (*bc.MerkleProof, error) { if txID == "3fa9a1a20c1f4dbd2c3dd5866749621ebe15c7290c13080ba0d45ab9c649cc15" { return nil, errors.New("oh no") }