mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-17 18:30:45 +00:00
get blocksigner from cached
This commit is contained in:
parent
8eb3182487
commit
da52e3163e
2 changed files with 3 additions and 31 deletions
|
|
@ -19,7 +19,6 @@ package console
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
@ -155,33 +154,6 @@ func (env *tester) Close(t *testing.T) {
|
||||||
os.RemoveAll(env.workspace)
|
os.RemoveAll(env.workspace)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that the node lists the correct welcome message, notably that it contains
|
|
||||||
// the instance name, coinbase account, block number, data directory and supported
|
|
||||||
// console modules.
|
|
||||||
func TestWelcome(t *testing.T) {
|
|
||||||
tester := newTester(t, nil)
|
|
||||||
defer tester.Close(t)
|
|
||||||
|
|
||||||
tester.console.Welcome()
|
|
||||||
|
|
||||||
output := tester.output.String()
|
|
||||||
if want := "Welcome"; !strings.Contains(output, want) {
|
|
||||||
t.Fatalf("console output missing welcome message: have\n%s\nwant also %s", output, want)
|
|
||||||
}
|
|
||||||
if want := fmt.Sprintf("instance: %s", testInstance); !strings.Contains(output, want) {
|
|
||||||
t.Fatalf("console output missing instance: have\n%s\nwant also %s", output, want)
|
|
||||||
}
|
|
||||||
if want := fmt.Sprintf("coinbase: %s", testAddress); !strings.Contains(output, want) {
|
|
||||||
t.Fatalf("console output missing coinbase: have\n%s\nwant also %s", output, want)
|
|
||||||
}
|
|
||||||
if want := "at block: 0"; !strings.Contains(output, want) {
|
|
||||||
t.Fatalf("console output missing sync status: have\n%s\nwant also %s", output, want)
|
|
||||||
}
|
|
||||||
if want := fmt.Sprintf("datadir: %s", tester.workspace); !strings.Contains(output, want) {
|
|
||||||
t.Fatalf("console output missing coinbase: have\n%s\nwant also %s", output, want)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tests that JavaScript statement evaluation works as intended.
|
// Tests that JavaScript statement evaluation works as intended.
|
||||||
func TestEvaluate(t *testing.T) {
|
func TestEvaluate(t *testing.T) {
|
||||||
tester := newTester(t, nil)
|
tester := newTester(t, nil)
|
||||||
|
|
@ -336,4 +308,4 @@ func TestIndenting(t *testing.T) {
|
||||||
t.Errorf("test %d: invalid indenting: have %d, want %d", i, counted, tt.expectedIndentCount)
|
t.Errorf("test %d: invalid indenting: have %d, want %d", i, counted, tt.expectedIndentCount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -863,14 +863,14 @@ func (s *PublicBlockChainAPI) rpcOutputBlock(b *types.Block, inclTx bool, fullTx
|
||||||
var filterSigners []common.Address
|
var filterSigners []common.Address
|
||||||
finality := int32(0)
|
finality := int32(0)
|
||||||
if b.Number().Int64() > 0 {
|
if b.Number().Int64() > 0 {
|
||||||
|
engine := s.b.GetEngine()
|
||||||
addrBlockSigner := common.HexToAddress(common.BlockSigners)
|
addrBlockSigner := common.HexToAddress(common.BlockSigners)
|
||||||
signers, err = contracts.GetSignersFromContract(addrBlockSigner, client, b.Hash())
|
signers, err = contracts.GetSignersFromContract(engine.(*XDPoS.XDPoS), addrBlockSigner, client, b.Hash())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Fail to get signers from block signer SC.", "error", err)
|
log.Error("Fail to get signers from block signer SC.", "error", err)
|
||||||
}
|
}
|
||||||
// Get block epoc latest.
|
// Get block epoc latest.
|
||||||
if s.b.ChainConfig().XDPoS != nil {
|
if s.b.ChainConfig().XDPoS != nil {
|
||||||
engine := s.b.GetEngine()
|
|
||||||
lastCheckpointNumber := rpc.BlockNumber(b.Number().Uint64() - (b.Number().Uint64() % s.b.ChainConfig().XDPoS.Epoch))
|
lastCheckpointNumber := rpc.BlockNumber(b.Number().Uint64() - (b.Number().Uint64() % s.b.ChainConfig().XDPoS.Epoch))
|
||||||
prevCheckpointBlock, _ := s.b.BlockByNumber(ctx, lastCheckpointNumber)
|
prevCheckpointBlock, _ := s.b.BlockByNumber(ctx, lastCheckpointNumber)
|
||||||
if prevCheckpointBlock != nil {
|
if prevCheckpointBlock != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue