Skip to content

Commit

Permalink
add boost test. update go-bpu and added require for parseconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
rohenaz committed Mar 3, 2023
1 parent 1b98fb0 commit 118f548
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
1 change: 1 addition & 0 deletions bob.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ func (t *Tx) FromRawTxString(rawTxString string) (err error) {
Token: &bpu.Token{
S: &separator,
},
Require: &opReturn,
},
}

Expand Down
19 changes: 18 additions & 1 deletion bob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ import (
"github.com/stretchr/testify/assert"
)

var sampleBobTx, sampleBobTxBadStrings, rawBobTx, parityBob, parityTx string
var sampleBobTx, sampleBobTxBadStrings, rawBobTx, parityBob, parityTx, boostTx string

func init() {
sampleBobTx = test.GetTestHex("./testing/bob/207eaadc096849e037b8944df21a8bba6d91d8445848db047c0a3f963121e19d.json")
sampleBobTxBadStrings = test.GetTestHex("./testing/bob/26b754e6fdf04121b8d91160a0b252a22ae30204fc552605b7f6d3f08419f29e.json")
rawBobTx = test.GetTestHex("./testing/tx/2.hex")
parityBob = test.GetTestHex("./testing/bob/98a5f6ef18eaea188bdfdc048f89a48af82627a15a76fd53584975f28ab3cc39.json")
parityTx = test.GetTestHex("./testing/tx/98a5f6ef18eaea188bdfdc048f89a48af82627a15a76fd53584975f28ab3cc39.hex")
boostTx = test.GetTestHex("./testing/tx/c5c7248302683107aa91014fd955908a7c572296e803512e497ddf7d1f458bd3.hex")
}

// TestNewFromBytes tests for nil case in NewFromBytes()
Expand Down Expand Up @@ -619,6 +620,22 @@ func TestTx_ToString2(t *testing.T) {

}

// Test Boost

func TestTx_Boost(t *testing.T) {
// import a tx from hex
goBobTx, err := NewFromRawTxString(boostTx)
assert.NoError(t, err)

if _, err = goBobTx.ToString(); err != nil {
fmt.Printf("error occurred: %s", err.Error())
}
assert.NoError(t, err)

assert.Equal(t, 89, len(goBobTx.Out[0].Tape[0].Cell))
}

// c5c7248302683107aa91014fd955908a7c572296e803512e497ddf7d1f458bd3
// BenchmarkTx_ToString benchmarks the method ToString()
func BenchmarkTx_ToString(b *testing.B) {
bobTx, _ := NewFromString(sampleBobTx)
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
require github.com/kr/pretty v0.3.1 // indirect

require (
github.com/bitcoinschema/go-bpu v0.0.3
github.com/bitcoinschema/go-bpu v0.0.4
github.com/bitcoinsv/bsvd v0.0.0-20190609155523-4c29707f7173 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/libsv/go-bk v0.1.6 // indirect
Expand All @@ -20,5 +20,3 @@ require (
golang.org/x/crypto v0.6.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

// replace github.com/libsv/go-bt => github.com/libsv/go-bt v1.0.4
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/bitcoinschema/go-bitcoin/v2 v2.0.3 h1:3pxGpFk7L2GcAx6VYW6kgcOmI0jhnZ/2zKSsfxqhvfM=
github.com/bitcoinschema/go-bitcoin/v2 v2.0.3/go.mod h1:MnikSx/hRXOS7dG3RlJOP2cV2lG6IOmoGd6HhvCB7Gc=
github.com/bitcoinschema/go-bpu v0.0.3 h1:Lz5BU36DYmod0lVPrMFO2NIG650PXRcC6e3SQhvpeeQ=
github.com/bitcoinschema/go-bpu v0.0.3/go.mod h1:i41D9NP5KIk/oCt8XrRhN27YerZCUG6vjScXDhNn5Us=
github.com/bitcoinschema/go-bpu v0.0.4 h1:EapuVhZcRD8ZOqBCcHUdzaMGOUmabvuXc6EvONBn5Mc=
github.com/bitcoinschema/go-bpu v0.0.4/go.mod h1:i41D9NP5KIk/oCt8XrRhN27YerZCUG6vjScXDhNn5Us=
github.com/bitcoinsv/bsvd v0.0.0-20190609155523-4c29707f7173 h1:2yTIV9u7H0BhRDGXH5xrAwAz7XibWJtX2dNezMeNsUo=
github.com/bitcoinsv/bsvd v0.0.0-20190609155523-4c29707f7173/go.mod h1:BZ1UcC9+tmcDEcdVXgpt13hMczwJxWzpAn68wNs7zRA=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0100000001e0ea284dbd5bac08e09c02ed3453b640e0fcd4d0b4cdeb3457002c6a78bea8f1000000006a4730440220221e92fad96878479cc637ae490eef446bf2903eaa8690c0f08f34f40da8c59e02200c2af911c1750720e9ef1056a791cbae8f344a3ff5800805ef95a387506f9c714121035cdc1e244b8dad15bf688ffef35450be993558f4345ebf9241727ccb669cc2fbffffffff02a086010000000000cf08626f6f7374706f7775045704000020d8d083b2d51f0652785201324105d3c39c662fa44062ccedacf883528b803273049cff631d067468656f727904890000001c746869732069732074686520426f6f737420776869746570617065727e7c557a766b7e52796b557a8254887e557a8258887e7c7eaa7c6b7e7e7c8254887e6c7e7c8254887eaa01007e816c825488537f7681530121a5696b768100a0691d00000000000000000000000000000000000000000000000000000000007e6c539458959901007e819f6976a96c88ac74ba0d00000000001976a914ed5bf460b28f7c7f1aff14737a4ec5277c83a8eb88ac1ee90b00

0 comments on commit 118f548

Please sign in to comment.