mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-14 07:53:47 +00:00
add : more comments
This commit is contained in:
parent
57e1282caf
commit
d5e51c9f76
1 changed files with 6 additions and 0 deletions
|
|
@ -61,6 +61,7 @@ func areDifferentHashes(receipts []map[string]interface{}) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test for GetTransactionReceiptsByBlock
|
||||||
func testGetTransactionReceiptsByBlock(t *testing.T, publicBlockchainAPI *ethapi.PublicBlockChainAPI) {
|
func testGetTransactionReceiptsByBlock(t *testing.T, publicBlockchainAPI *ethapi.PublicBlockChainAPI) {
|
||||||
// check 1 : zero transactions
|
// check 1 : zero transactions
|
||||||
receiptsOut, err := publicBlockchainAPI.GetTransactionReceiptsByBlock(context.Background(), rpc.BlockNumberOrHashWithNumber(1))
|
receiptsOut, err := publicBlockchainAPI.GetTransactionReceiptsByBlock(context.Background(), rpc.BlockNumberOrHashWithNumber(1))
|
||||||
|
|
@ -99,6 +100,7 @@ func testGetTransactionReceiptsByBlock(t *testing.T, publicBlockchainAPI *ethapi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test for GetTransactionByBlockNumberAndIndex
|
||||||
func testGetTransactionByBlockNumberAndIndex(t *testing.T, publicTransactionPoolAPI *ethapi.PublicTransactionPoolAPI) {
|
func testGetTransactionByBlockNumberAndIndex(t *testing.T, publicTransactionPoolAPI *ethapi.PublicTransactionPoolAPI) {
|
||||||
// check 1 : False ( no transaction )
|
// check 1 : False ( no transaction )
|
||||||
tx := publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(1), 0)
|
tx := publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(1), 0)
|
||||||
|
|
@ -125,6 +127,8 @@ func testGetTransactionByBlockNumberAndIndex(t *testing.T, publicTransactionPool
|
||||||
assert.Equal(t, common.HexToAddress("0x0"), *tx.To)
|
assert.Equal(t, common.HexToAddress("0x0"), *tx.To)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This Testcase tests functions for RPC API calls.
|
||||||
|
// NOTE : Changes to this function might affect the child testcases.
|
||||||
func TestAPIs(t *testing.T) {
|
func TestAPIs(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
@ -240,9 +244,11 @@ func TestAPIs(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Testing GetTransactionReceiptsByBlock
|
||||||
publicBlockchainAPI := backend.PublicBlockChainAPI()
|
publicBlockchainAPI := backend.PublicBlockChainAPI()
|
||||||
testGetTransactionReceiptsByBlock(t, publicBlockchainAPI)
|
testGetTransactionReceiptsByBlock(t, publicBlockchainAPI)
|
||||||
|
|
||||||
|
// Testing GetTransactionByBlockNumberAndIndex
|
||||||
nonceLock := new(ethapi.AddrLocker)
|
nonceLock := new(ethapi.AddrLocker)
|
||||||
publicTransactionPoolAPI := ethapi.NewPublicTransactionPoolAPI(backend.APIBackend, nonceLock)
|
publicTransactionPoolAPI := ethapi.NewPublicTransactionPoolAPI(backend.APIBackend, nonceLock)
|
||||||
testGetTransactionByBlockNumberAndIndex(t, publicTransactionPoolAPI)
|
testGetTransactionByBlockNumberAndIndex(t, publicTransactionPoolAPI)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue