5affed38fc
This commit makes a large number of minor changes concerning API usage within the deamon to match the latest version on the upstream btcsuite libraries. The major changes are the switch from wire.ShaHash to chainhash.Hash, and that wire.NewMsgTx() now takes a paramter indicating the version of the transaction to be created.
58 lines
1013 B
Go
58 lines
1013 B
Go
package elkrem
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/roasbeef/btcd/chaincfg/chainhash"
|
|
)
|
|
|
|
// TestElkremBig tries 10K hashes
|
|
func TestElkremBig(t *testing.T) {
|
|
var rcv ElkremReceiver
|
|
|
|
sndr := NewElkremSender(chainhash.DoubleHashH([]byte("elktest")))
|
|
|
|
for n := uint64(0); n < 10000; n++ {
|
|
sha, err := sndr.AtIndex(n)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if err = rcv.AddNext(sha); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
ReceiverSerdesTest(t, &rcv)
|
|
|
|
for n := uint64(0); n < 10000; n += 500 {
|
|
if _, err := rcv.AtIndex(n); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
// TestElkremLess tries 10K hashes
|
|
func TestElkremLess(t *testing.T) {
|
|
var rcv ElkremReceiver
|
|
|
|
sndr := NewElkremSender(chainhash.DoubleHashH([]byte("elktest2")))
|
|
|
|
for n := uint64(0); n < 5000; n++ {
|
|
sha, err := sndr.AtIndex(n)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if err = rcv.AddNext(sha); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
for n := uint64(0); n < 5000; n += 500 {
|
|
if _, err := rcv.AtIndex(n); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
}
|