@ -584,6 +584,11 @@ func testCallContract(t *testing.T, client *rpc.Client) {
func testAtFunctions ( t * testing . T , client * rpc . Client ) {
func testAtFunctions ( t * testing . T , client * rpc . Client ) {
ec := NewClient ( client )
ec := NewClient ( client )
block , err := ec . HeaderByNumber ( context . Background ( ) , big . NewInt ( 1 ) )
if err != nil {
t . Fatalf ( "BlockByNumber error: %v" , err )
}
// send a transaction for some interesting pending status
// send a transaction for some interesting pending status
sendTransaction ( ec )
sendTransaction ( ec )
time . Sleep ( 100 * time . Millisecond )
time . Sleep ( 100 * time . Millisecond )
@ -601,6 +606,13 @@ func testAtFunctions(t *testing.T, client *rpc.Client) {
if err != nil {
if err != nil {
t . Fatalf ( "unexpected error: %v" , err )
t . Fatalf ( "unexpected error: %v" , err )
}
}
hashBalance , err := ec . BalanceAtHash ( context . Background ( ) , testAddr , block . Hash ( ) )
if err != nil {
t . Fatalf ( "unexpected error: %v" , err )
}
if balance . Cmp ( hashBalance ) == 0 {
t . Fatalf ( "unexpected balance at hash: %v %v" , balance , hashBalance )
}
penBalance , err := ec . PendingBalanceAt ( context . Background ( ) , testAddr )
penBalance , err := ec . PendingBalanceAt ( context . Background ( ) , testAddr )
if err != nil {
if err != nil {
t . Fatalf ( "unexpected error: %v" , err )
t . Fatalf ( "unexpected error: %v" , err )
@ -613,6 +625,13 @@ func testAtFunctions(t *testing.T, client *rpc.Client) {
if err != nil {
if err != nil {
t . Fatalf ( "unexpected error: %v" , err )
t . Fatalf ( "unexpected error: %v" , err )
}
}
hashNonce , err := ec . NonceAtHash ( context . Background ( ) , testAddr , block . Hash ( ) )
if err != nil {
t . Fatalf ( "unexpected error: %v" , err )
}
if hashNonce == nonce {
t . Fatalf ( "unexpected nonce at hash: %v %v" , nonce , hashNonce )
}
penNonce , err := ec . PendingNonceAt ( context . Background ( ) , testAddr )
penNonce , err := ec . PendingNonceAt ( context . Background ( ) , testAddr )
if err != nil {
if err != nil {
t . Fatalf ( "unexpected error: %v" , err )
t . Fatalf ( "unexpected error: %v" , err )
@ -625,6 +644,13 @@ func testAtFunctions(t *testing.T, client *rpc.Client) {
if err != nil {
if err != nil {
t . Fatalf ( "unexpected error: %v" , err )
t . Fatalf ( "unexpected error: %v" , err )
}
}
hashStorage , err := ec . StorageAtHash ( context . Background ( ) , testAddr , common . Hash { } , block . Hash ( ) )
if err != nil {
t . Fatalf ( "unexpected error: %v" , err )
}
if ! bytes . Equal ( storage , hashStorage ) {
t . Fatalf ( "unexpected storage at hash: %v %v" , storage , hashStorage )
}
penStorage , err := ec . PendingStorageAt ( context . Background ( ) , testAddr , common . Hash { } )
penStorage , err := ec . PendingStorageAt ( context . Background ( ) , testAddr , common . Hash { } )
if err != nil {
if err != nil {
t . Fatalf ( "unexpected error: %v" , err )
t . Fatalf ( "unexpected error: %v" , err )
@ -637,6 +663,13 @@ func testAtFunctions(t *testing.T, client *rpc.Client) {
if err != nil {
if err != nil {
t . Fatalf ( "unexpected error: %v" , err )
t . Fatalf ( "unexpected error: %v" , err )
}
}
hashCode , err := ec . CodeAtHash ( context . Background ( ) , common . Address { } , block . Hash ( ) )
if err != nil {
t . Fatalf ( "unexpected error: %v" , err )
}
if ! bytes . Equal ( code , hashCode ) {
t . Fatalf ( "unexpected code at hash: %v %v" , code , hashCode )
}
penCode , err := ec . PendingCodeAt ( context . Background ( ) , testAddr )
penCode , err := ec . PendingCodeAt ( context . Background ( ) , testAddr )
if err != nil {
if err != nil {
t . Fatalf ( "unexpected error: %v" , err )
t . Fatalf ( "unexpected error: %v" , err )