pub trait AlertRpc {
// Required method
fn send_alert(&self, alert: Alert) -> Result<()>;
}
Expand description
RPC Module Alert for network alerts.
An alert is a message about critical problems to be broadcast to all nodes via the p2p network.
The alerts must be signed by 2-of-4 signatures, where the public keys are hard-coded in the source code and belong to early CKB developers.
Required Methods§
sourcefn send_alert(&self, alert: Alert) -> Result<()>
fn send_alert(&self, alert: Alert) -> Result<()>
Sends an alert.
This RPC returns null
on success.
§Errors
AlertFailedToVerifySignatures (-1000)
- Some signatures in the request are invalid.P2PFailedToBroadcast (-101)
- Alert is saved locally but has failed to broadcast to the P2P network.InvalidParams (-32602)
- The time specified inalert.notice_until
must be in the future.
§Examples
Request
{
"jsonrpc": "2.0",
"method": "send_alert",
"params": [
{
"id": "0x1",
"cancel": "0x0",
"priority": "0x1",
"message": "An example alert message!",
"notice_until": "0x24bcca57c00",
"signatures": [
"0xbd07059aa9a3d057da294c2c4d96fa1e67eeb089837c87b523f124239e18e9fc7d11bb95b720478f7f937d073517d0e4eb9a91d12da5c88a05f750362f4c214dd0",
"0x0242ef40bb64fe3189284de91f981b17f4d740c5e24a3fc9b70059db6aa1d198a2e76da4f84ab37549880d116860976e0cf81cd039563c452412076ebffa2e4453"
]
}
],
"id": 42
}
Response
{
"error": {
"code": -1000,
"data": "SigNotEnough",
"message":"AlertFailedToVerifySignatures: The count of sigs is less than threshold."
},
"jsonrpc": "2.0",
"result": null,
"id": 42
}