mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
feat: change state network dep
This commit is contained in:
parent
f00c767e54
commit
df86d197c1
3 changed files with 5 additions and 6 deletions
|
|
@ -290,7 +290,8 @@ func initState(config Config, server *rpc.Server, conn discover.UDPConn, localNo
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
historyNetwork := state.NewStateNetwork(protocol, server)
|
||||
client := rpc.DialInProc(server)
|
||||
historyNetwork := state.NewStateNetwork(protocol, client)
|
||||
return historyNetwork.Start()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,11 +29,8 @@ type StateNetwork struct {
|
|||
client *rpc.Client
|
||||
}
|
||||
|
||||
func NewStateNetwork(portalProtocol *discover.PortalProtocol, rpcServer *rpc.Server) *StateNetwork {
|
||||
func NewStateNetwork(portalProtocol *discover.PortalProtocol, client *rpc.Client) *StateNetwork {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
client := rpc.DialInProc(rpcServer)
|
||||
|
||||
return &StateNetwork{
|
||||
portalProtocol: portalProtocol,
|
||||
closeCtx: ctx,
|
||||
|
|
|
|||
|
|
@ -65,7 +65,8 @@ func TestValidateAccountTrieNode(t *testing.T) {
|
|||
header: tt.BlockHeader,
|
||||
}
|
||||
server.RegisterName("portal", api)
|
||||
bn := NewStateNetwork(nil, server)
|
||||
client := rpc.DialInProc(server)
|
||||
bn := NewStateNetwork(nil, client)
|
||||
err = bn.validateContent(hexutil.MustDecode(tt.ContentKey), hexutil.MustDecode(tt.ContentValueOffer))
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue