mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-12 06:53:46 +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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
historyNetwork := state.NewStateNetwork(protocol, server)
|
client := rpc.DialInProc(server)
|
||||||
|
historyNetwork := state.NewStateNetwork(protocol, client)
|
||||||
return historyNetwork.Start()
|
return historyNetwork.Start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,8 @@ type StateNetwork struct {
|
||||||
client *rpc.Client
|
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())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
|
||||||
client := rpc.DialInProc(rpcServer)
|
|
||||||
|
|
||||||
return &StateNetwork{
|
return &StateNetwork{
|
||||||
portalProtocol: portalProtocol,
|
portalProtocol: portalProtocol,
|
||||||
closeCtx: ctx,
|
closeCtx: ctx,
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,8 @@ func TestValidateAccountTrieNode(t *testing.T) {
|
||||||
header: tt.BlockHeader,
|
header: tt.BlockHeader,
|
||||||
}
|
}
|
||||||
server.RegisterName("portal", api)
|
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))
|
err = bn.validateContent(hexutil.MustDecode(tt.ContentKey), hexutil.MustDecode(tt.ContentValueOffer))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue