mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
cleaned up getBlock and getAllBlocks fns
This commit is contained in:
parent
668287603e
commit
6de8563ee2
2 changed files with 3 additions and 25 deletions
|
|
@ -74,7 +74,7 @@ func GetBlock(w http.ResponseWriter, r *http.Request) {
|
|||
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
fmt.Fprintln(w, "block", getBlockResponse)
|
||||
fmt.Fprintln(w, getBlockResponse)
|
||||
}
|
||||
|
||||
// GetAllBlocks response
|
||||
|
|
@ -96,7 +96,7 @@ func GetAllBlocks(w http.ResponseWriter, r *http.Request) {
|
|||
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
fmt.Fprintln(w, "blocksss", block3)
|
||||
fmt.Fprintln(w, block3)
|
||||
}
|
||||
|
||||
//GetInternalTransactions gets internal txs
|
||||
|
|
|
|||
|
|
@ -282,7 +282,6 @@ func GetAllBlocks(sqldb *sql.DB) []SBlock {
|
|||
FROM blocks`)
|
||||
if err != nil {
|
||||
fmt.Println("err")
|
||||
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
|
|
@ -319,7 +318,7 @@ func GetBlock(sqldb *sql.DB) []SBlock {
|
|||
case sql.ErrNoRows:
|
||||
fmt.Println("No rows were returned!")
|
||||
case nil:
|
||||
fmt.Println(row)
|
||||
fmt.Println(num, hash, coinbase)
|
||||
default:
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -331,27 +330,6 @@ func GetBlock(sqldb *sql.DB) []SBlock {
|
|||
return arr.Blocks
|
||||
}
|
||||
|
||||
// []SBlock {
|
||||
// var block []SBlock
|
||||
// var number string
|
||||
// var hash string
|
||||
// var coinbase string
|
||||
|
||||
// sqlStatement := `SELECT * FROM blocks WHERE number=$1;`
|
||||
// row := sqldb.QueryRow(sqlStatement, 3)
|
||||
// err := row.Scan(&number, &hash, &coinbase)
|
||||
// switch err {
|
||||
// case sql.ErrNoRows:
|
||||
// fmt.Println("No rows were returned")
|
||||
// return block
|
||||
// case nil:
|
||||
// fmt.Println("nil")
|
||||
// default:
|
||||
// panic(err)
|
||||
// }
|
||||
// fmt.Println("this is a query", row)
|
||||
// return block
|
||||
|
||||
func GetAllTransactions(db *leveldb.DB) []ShyftTxEntryPretty {
|
||||
var txs []ShyftTxEntryPretty
|
||||
iter := db.NewIterator(util.BytesPrefix([]byte("tx-")), nil)
|
||||
|
|
|
|||
Loading…
Reference in a new issue