mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
resolving conflicts
This commit is contained in:
parent
b4e9ef8a64
commit
8a8c886ef1
3 changed files with 19 additions and 17 deletions
|
|
@ -8,7 +8,6 @@ import (
|
|||
"database/sql"
|
||||
"log"
|
||||
_ "github.com/lib/pq"
|
||||
"fmt"
|
||||
"github.com/ShyftNetwork/go-empyrean/common"
|
||||
"github.com/ShyftNetwork/go-empyrean/core/types"
|
||||
Rewards "github.com/ShyftNetwork/go-empyrean/consensus/ethash"
|
||||
|
|
@ -300,11 +299,9 @@ func swriteBalanceHelper(sqldb *sql.DB, tx *types.Transaction) (SendAndReceive,
|
|||
Amount: tx.Value().String(),
|
||||
}
|
||||
|
||||
fmt.Println("TO", sendAndReceiveData.To)
|
||||
fmt.Println("FROM", sendAndReceiveData.From)
|
||||
getAccountBalanceReceiver := SGetAccount(sqldb, sendAndReceiveData.To)
|
||||
getAccountBalanceSender:= SGetAccount(sqldb, sendAndReceiveData.From)
|
||||
fmt.Println("HERE", getAccountBalanceReceiver)
|
||||
|
||||
var receiverData SendAndReceive
|
||||
if err := json.Unmarshal([]byte(getAccountBalanceReceiver), &receiverData); err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
|
|||
|
|
@ -280,20 +280,25 @@ func SGetTransaction(sqldb *sql.DB, txHash string) string {
|
|||
return string(json)
|
||||
}
|
||||
|
||||
//GetAccount returns account balances
|
||||
func SGetAccount(sqldb *sql.DB, address string) string {
|
||||
func InnerSGetAccount(sqldb *sql.DB, address string) (SAccounts, bool) {
|
||||
sqlStatement := `SELECT * FROM accounts WHERE addr=$1;`
|
||||
row := sqldb.QueryRow(sqlStatement, address)
|
||||
var addr, balance, accountNonce string
|
||||
|
||||
row.Scan(
|
||||
&addr, &balance, &accountNonce)
|
||||
|
||||
err := sqldb.QueryRow(sqlStatement, address).Scan(&addr, &balance, &accountNonce)
|
||||
if err == sql.ErrNoRows {
|
||||
return SAccounts{}, false
|
||||
} else {
|
||||
account := SAccounts{
|
||||
Addr: addr,
|
||||
Balance: balance,
|
||||
AccountNonce: accountNonce,
|
||||
}
|
||||
return account, true
|
||||
}
|
||||
}
|
||||
|
||||
//GetAccount returns account balances
|
||||
func SGetAccount(sqldb *sql.DB, address string) string {
|
||||
var account, _ = InnerSGetAccount(sqldb, address)
|
||||
json, _ := json.Marshal(account)
|
||||
return string(json)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue