Persistance (#53)
* added publish TX for backwards compat. * lowered the prototick for faster block syncing * print useragent on startup * added createMultiRedeemScript for genesis block generation. * building genesis block from scratch. * implemented merkle tree. * starting blockhain with generated genesis hash * Fixed bug in unspent coin state. * fixed broken tests after genesis block. * removed log line. * bumped version -> 0.34.0
This commit is contained in:
parent
ad9333c74c
commit
94672cb9cc
35 changed files with 955 additions and 187 deletions
|
@ -1 +1,50 @@
|
|||
package util
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestUInt160DecodeString(t *testing.T) {
|
||||
hexStr := "2d3b96ae1bcc5a585e075e3b81920210dec16302"
|
||||
val, err := Uint160DecodeString(hexStr)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
assert.Equal(t, hexStr, val.String())
|
||||
}
|
||||
|
||||
func TestUint160DecodeBytes(t *testing.T) {
|
||||
hexStr := "2d3b96ae1bcc5a585e075e3b81920210dec16302"
|
||||
b, err := hex.DecodeString(hexStr)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
val, err := Uint160DecodeBytes(b)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
assert.Equal(t, hexStr, val.String())
|
||||
}
|
||||
|
||||
func TestUInt160Equals(t *testing.T) {
|
||||
a := "2d3b96ae1bcc5a585e075e3b81920210dec16302"
|
||||
b := "4d3b96ae1bcc5a585e075e3b81920210dec16302"
|
||||
|
||||
ua, err := Uint160DecodeString(a)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
ub, err := Uint160DecodeString(b)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if ua.Equals(ub) {
|
||||
t.Fatalf("%s and %s cannot be equal", ua, ub)
|
||||
}
|
||||
if !ua.Equals(ua) {
|
||||
t.Fatalf("%s and %s must be equal", ua, ua)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue