-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhancement: NewTxFromReader and VarInt datatype (#88)
* added newtxfromreader func. added varint data type * better error messaging * fixed linter * removed unneeded brackets * unexported test data dir * lint * better test name
- Loading branch information
1 parent
792a281
commit 83c90f3
Showing
13 changed files
with
320 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package data | ||
|
||
import ( | ||
"embed" | ||
"io/fs" | ||
"path" | ||
) | ||
|
||
// testDataDir a directory container test data. | ||
type testDataDir struct { | ||
prefix string | ||
fs embed.FS | ||
} | ||
|
||
//go:embed tx/bin/* | ||
var txBinData embed.FS | ||
|
||
// TxBinData data for binary txs. | ||
var TxBinData = testDataDir{ | ||
prefix: "tx/bin", | ||
fs: txBinData, | ||
} | ||
|
||
// Open a file. | ||
func (d *testDataDir) Open(file string) (fs.File, error) { | ||
return d.fs.Open(path.Join(d.prefix, file)) | ||
} | ||
|
||
// Load the data of a file. | ||
func (d *testDataDir) Load(file string) ([]byte, error) { | ||
return d.fs.ReadFile(path.Join(d.prefix, file)) | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.