mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
updating balances working correctly, test suite incomplete for accounts
This commit is contained in:
parent
d760a7caa7
commit
ba48ad13e9
7 changed files with 31 additions and 44 deletions
|
|
@ -29,7 +29,6 @@ import (
|
|||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
|
||||
"github.com/ShyftNetwork/go-empyrean/common"
|
||||
"github.com/ShyftNetwork/go-empyrean/common/mclock"
|
||||
"github.com/ShyftNetwork/go-empyrean/consensus"
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ import (
|
|||
"encoding/binary"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"math/big"
|
||||
"fmt"
|
||||
"math/big"
|
||||
|
||||
"github.com/ShyftNetwork/go-empyrean/common"
|
||||
"github.com/ShyftNetwork/go-empyrean/core/types"
|
||||
|
|
@ -283,14 +283,7 @@ func GetTxLookupEntry(db DatabaseReader, hash common.Hash) (common.Hash, uint64,
|
|||
// its added positional metadata.
|
||||
func GetTransaction(db DatabaseReader, hash common.Hash) (*types.Transaction, common.Hash, uint64, uint64) {
|
||||
// Retrieve the lookup metadata and resolve the transaction from the body
|
||||
//fmt.Println("INSIDE GET TRANSACTION ++++++++")
|
||||
//fmt.Println("The hash and db reader are")
|
||||
//fmt.Println(hash)
|
||||
//fmt.Println(db)
|
||||
blockHash, blockNumber, txIndex := GetTxLookupEntry(db, hash)
|
||||
//fmt.Println(blockHash)
|
||||
//fmt.Println(blockNumber)
|
||||
|
||||
if blockHash != (common.Hash{}) {
|
||||
body := GetBody(db, blockHash, blockNumber)
|
||||
if body == nil || len(body.Transactions) <= int(txIndex) {
|
||||
|
|
|
|||
|
|
@ -146,12 +146,6 @@ func SWriteBlock(block *types.Block, receipts []*types.Receipt) error {
|
|||
if block.Transactions().Len() > 0 {
|
||||
for _, tx := range block.Transactions() {
|
||||
swriteTransactions(sqldb, tx, block.Header().Hash(), blockData.Number, receipts, age, blockData.GasLimit)
|
||||
// if block.Transactions()[0].To() != nil {
|
||||
// swriteBalance(sqldb, tx)
|
||||
// }
|
||||
// if block.Transactions()[0].To() == nil {
|
||||
// swriteContractBalance(sqldb, tx)
|
||||
// }
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
@ -243,7 +237,7 @@ func adjustBalanceFromAddr(sqldb *sql.DB, s SendAndReceive, value *big.Int) {
|
|||
fromAddressBalance, fromAccountNonce, err := AccountExists(sqldb, s.From)
|
||||
switch {
|
||||
case err == sql.ErrNoRows:
|
||||
fmt.Println("wtf", s.From)
|
||||
fmt.Println("Need to write From", s.From)
|
||||
}
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
|
|||
|
|
@ -631,8 +631,6 @@ func (api *PrivateDebugAPI) StraceTx(ctx context.Context, message core.Message,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// traceTx configures a new tracer according to the provided configuration, and
|
||||
// executes the given message in the provided environment. The return value will
|
||||
// be tracer dependent.
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
package eth
|
||||
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/ShyftNetwork/go-empyrean/common"
|
||||
"github.com/ShyftNetwork/go-empyrean/params"
|
||||
"context"
|
||||
)
|
||||
|
||||
var EthereumObject interface{}
|
||||
|
|
@ -29,6 +30,7 @@ func InitTracerEnv() {
|
|||
}
|
||||
TracerConfig = config
|
||||
fullNode, _ := SNew(Global_config)
|
||||
fmt.Println("FULL NODE", fullNode)
|
||||
privateAPI := NewPrivateDebugAPI(config2, fullNode)
|
||||
PrivateAPI = privateAPI
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ import (
|
|||
"time"
|
||||
"unsafe"
|
||||
|
||||
"strconv"
|
||||
|
||||
"github.com/ShyftNetwork/go-empyrean/common"
|
||||
"github.com/ShyftNetwork/go-empyrean/common/hexutil"
|
||||
"github.com/ShyftNetwork/go-empyrean/core"
|
||||
|
|
@ -32,7 +34,6 @@ import (
|
|||
"github.com/ShyftNetwork/go-empyrean/crypto"
|
||||
"github.com/ShyftNetwork/go-empyrean/log"
|
||||
"gopkg.in/olebedev/go-duktape.v3"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// bigIntegerJS is the minified version of https://github.com/peterolson/BigInteger.js.
|
||||
|
|
@ -615,7 +616,6 @@ func (i *Internals) SWriteInteralTxs(hash common.Hash) {
|
|||
Output: i.Output,
|
||||
Time: i.Time,
|
||||
}
|
||||
|
||||
//@TODO WRITE OVER TRANSACTION STRUCT
|
||||
core.SWriteInternalTxBalances(sqldb, i.To, i.From, amount)
|
||||
core.InsertInternalTx(sqldb, iTx)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package shyftdb
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
|
@ -318,13 +319,13 @@ func TestBlock(t *testing.T) {
|
|||
t.Fatalf("isContract [%v]: isContract bool is incorrect", isContract)
|
||||
}
|
||||
}
|
||||
|
||||
if getAllTx := core.SGetAllTransactions(sqldb); len(getAllTx) == 0 {
|
||||
t.Fatalf("GetAllTransactions [%v]: GetAllTransactions did not return correctly", getAllTx)
|
||||
}
|
||||
})
|
||||
t.Run("TestAccountsToReturnAccounts", func(t *testing.T) {
|
||||
for _, tx := range txs {
|
||||
fmt.Println("test account", tx.To().String())
|
||||
accountAddrTo := core.SGetAccount(sqldb, tx.To().String())
|
||||
byts := []byte(accountAddrTo)
|
||||
var accountDataTo core.SAccounts
|
||||
|
|
|
|||
Loading…
Reference in a new issue