prysm-pulse/beacon-chain/db/deposit_contract_test.go
Raul Jordan b06876d698
Implement Node gRPC Server (#3049)
* add node server

* stub implementations

* node server impl

* gaz

* only missing genesis info now

* fmt imports

* all tests pass

* fmt

* revert change

* punctuation

* use internal err code

* view permission

* using real reflection

* spacing

* lint
2019-07-22 21:19:55 -05:00

32 lines
856 B
Go

package db
import (
"context"
"testing"
"github.com/ethereum/go-ethereum/common"
)
func TestVerifyContractAddress(t *testing.T) {
db := setupDB(t)
defer teardownDB(t, db)
ctx := context.Background()
address := common.HexToAddress("0x0cd549b4abcbc0cb63012ea7de6fd34ebdccfd45")
// There should be no error the first time.
if err := db.VerifyContractAddress(ctx, address); err != nil {
t.Fatalf("Unexpected error: %v", err)
}
// There should be no error the second time.
if err := db.VerifyContractAddress(ctx, address); err != nil {
t.Fatalf("Unexpected error: %v", err)
}
// But there should be an error with a different address.
otherAddr := common.HexToAddress("0x247b06d9890ab9b032ec318ca436aef262d0f08a")
if err := db.VerifyContractAddress(ctx, otherAddr); err == nil {
t.Fatal("Expected error, but didn't receive one")
}
}