namereg rpc and tests

This commit is contained in:
Ethan Buchman
2015-05-22 17:03:22 -04:00
parent 8631d5085e
commit baaa69d7f8
9 changed files with 173 additions and 2 deletions

View File

@ -120,6 +120,13 @@ func makeDefaultCallTx(t *testing.T, typ string, addr, code []byte, amt, gasLim,
return tx
}
func makeDefaultNameTx(t *testing.T, typ string, name, value []byte, amt, fee uint64) *types.NameTx {
nonce := getNonce(t, typ, user[0].Address)
tx := types.NewNameTxWithNonce(user[0].PubKey, name, value, amt, fee, nonce)
tx.Sign(user[0])
return tx
}
//-------------------------------------------------------------------------------
// rpc call wrappers (fail on err)
@ -210,6 +217,16 @@ func callContract(t *testing.T, client cclient.Client, address, data, expected [
}
}
// get the namereg entry
func getNameRegEntry(t *testing.T, typ string, name []byte) *types.NameRegEntry {
client := clients[typ]
r, err := client.NameRegEntry(name)
if err != nil {
t.Fatal(err)
}
return r.Entry
}
//--------------------------------------------------------------------------------
// utility verification function