The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
woop/harmony/main.go

57 lines
1.3 KiB

6 years ago
package main
import (
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/params"
"github.com/simple-rules/harmony-benchmark/core"
"github.com/simple-rules/harmony-benchmark/core/types"
"math/big"
)
var (
// Test accounts
testBankKey, _ = crypto.GenerateKey()
testBankAddress = crypto.PubkeyToAddress(testBankKey.PublicKey)
testBankFunds = big.NewInt(1000000000000000000)
testUserKey, _ = crypto.GenerateKey()
testUserAddress = crypto.PubkeyToAddress(testUserKey.PublicKey)
chainConfig = params.TestChainConfig
// Test transactions
pendingTxs []*types.Transaction
newTxs []*types.Transaction
)
type testWorkerBackend struct {
db ethdb.Database
txPool *core.TxPool
chain *core.BlockChain
}
func main() {
var (
database = ethdb.NewMemDatabase()
gspec = core.Genesis{
Config: chainConfig,
Alloc: core.GenesisAlloc{testBankAddress: {Balance: testBankFunds}},
}
)
chain, _ := core.NewBlockChain(database, nil, gspec.Config, nil, vm.Config{}, nil)
txpool := core.NewTxPool(core.DefaultTxPoolConfig, chainConfig, chain)
backend := &testWorkerBackend{
db: database,
chain: chain,
txPool: txpool,
}
backend.txPool.AddLocals(pendingTxs)
}