mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-11-24 06:25:55 +00:00
Add UpdatePruningPointIfRequired on init
This commit is contained in:
parent
9b1b20bf4c
commit
90bc669d96
@ -540,6 +540,8 @@ func (f *factory) NewConsensus(config *Config, db infrastructuredatabase.Databas
|
||||
return nil, false, err
|
||||
}
|
||||
|
||||
// If the virtual moved before shutdown but the pruning point hasn't, we
|
||||
// move it if needed.
|
||||
stagingArea := model.NewStagingArea()
|
||||
err = pruningManager.UpdatePruningPointByVirtual(stagingArea)
|
||||
if err != nil {
|
||||
@ -551,6 +553,11 @@ func (f *factory) NewConsensus(config *Config, db infrastructuredatabase.Databas
|
||||
return nil, false, err
|
||||
}
|
||||
|
||||
err = pruningManager.UpdatePruningPointIfRequired()
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
|
||||
return c, false, nil
|
||||
}
|
||||
|
||||
|
||||
20
infrastructure/network/rpcclient/rpc_ban.go
Normal file
20
infrastructure/network/rpcclient/rpc_ban.go
Normal file
@ -0,0 +1,20 @@
|
||||
package rpcclient
|
||||
|
||||
import "github.com/kaspanet/kaspad/app/appmessage"
|
||||
|
||||
// Ban sends an RPC request respective to the function's name and returns the RPC server's response
|
||||
func (c *RPCClient) Ban(ip string) (*appmessage.BanResponseMessage, error) {
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewBanRequestMessage(ip))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response, err := c.route(appmessage.CmdBanRequestMessage).DequeueWithTimeout(c.timeout)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
banResponse := response.(*appmessage.BanResponseMessage)
|
||||
if banResponse.Error != nil {
|
||||
return nil, c.convertRPCError(banResponse.Error)
|
||||
}
|
||||
return banResponse, nil
|
||||
}
|
||||
20
infrastructure/network/rpcclient/rpc_unban.go
Normal file
20
infrastructure/network/rpcclient/rpc_unban.go
Normal file
@ -0,0 +1,20 @@
|
||||
package rpcclient
|
||||
|
||||
import "github.com/kaspanet/kaspad/app/appmessage"
|
||||
|
||||
// Unban sends an RPC request respective to the function's name and returns the RPC server's response
|
||||
func (c *RPCClient) Unban(ip string) (*appmessage.UnbanResponseMessage, error) {
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewUnbanRequestMessage(ip))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response, err := c.route(appmessage.CmdUnbanRequestMessage).DequeueWithTimeout(c.timeout)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
unbanResponse := response.(*appmessage.UnbanResponseMessage)
|
||||
if unbanResponse.Error != nil {
|
||||
return nil, c.convertRPCError(unbanResponse.Error)
|
||||
}
|
||||
return unbanResponse, nil
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user