Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
fix(prover): change separator (#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored Dec 7, 2023
1 parent c2ce6ac commit 8e8897f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions prover/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

var (
BlockKeyPrefix = "block-"
separator = "++"
)

type SignedBlockData struct {
Expand All @@ -34,11 +35,11 @@ func BuildBlockValue(hash []byte, signature []byte, blockID *big.Int) []byte {
hash,
signature,
blockID.Bytes(),
}, []byte("-"))
}, []byte(separator))
}

func SignedBlockDataFromValue(val []byte) SignedBlockData {
v := bytes.Split(val, []byte("-"))
v := bytes.Split(val, []byte(separator))

return SignedBlockData{
BlockID: new(big.Int).SetBytes(v[2]),
Expand Down
2 changes: 1 addition & 1 deletion prover/db/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func Test_BuildBlockKey(t *testing.T) {

func Test_BuildBlockValue(t *testing.T) {
v := BuildBlockValue([]byte("hash"), []byte("sig"), big.NewInt(1))
spl := bytes.Split(v, []byte("-"))
spl := bytes.Split(v, []byte(separator))
assert.Equal(t, "hash", string(spl[0]))
assert.Equal(t, "sig", string(spl[1]))
assert.Equal(t, uint64(1), new(big.Int).SetBytes(spl[2]).Uint64())
Expand Down

0 comments on commit 8e8897f

Please sign in to comment.