public class AlertMessage extends Message
The right course of action on receiving an alert is usually to either ensure a human will see it (display on screen, log, email), or if you decide to use alerts for notifications that are specific to your app in some way, to parse it. For example, you could treat it as an upgrade notification specific to your app. Satoshi designed alerts to ensure that software upgrades could be distributed independently of a hard-coded website, in order to allow everything to be purely peer-to-peer. You don't have to use this of course, and indeed it often makes more sense not to.
Before doing anything with an alert, you should check isSignatureValid()
.
Instances of this class are not safe for use by multiple threads.
cursor, length, MAX_SIZE, offset, params, payload, recached, serializer, UNKNOWN_LENGTH
Constructor and Description |
---|
AlertMessage(NetworkParameters params,
byte[] payloadBytes) |
Modifier and Type | Method and Description |
---|---|
long |
getCancel()
A marker that results in any alerts with an ID lower than this value to be considered cancelled.
|
java.lang.String |
getComment()
This field is unused.
|
java.util.Date |
getExpiration()
The time at which the alert ceases to be relevant.
|
long |
getId()
The numeric identifier of this alert.
|
long |
getMaxVer()
The inclusive upper bound on software versions considered for the purposes of this alert.
|
long |
getMinVer()
The inclusive lower bound on software versions that are considered for the purposes of this alert.
|
long |
getPriority()
Provides an integer ordering amongst simultaneously active alerts.
|
java.util.Date |
getRelayUntil()
The time at which the alert should stop being broadcast across the network.
|
java.lang.String |
getReserved()
This field is never used.
|
java.lang.String |
getStatusBar()
A string that is intended to display in the status bar of Bitcoin Core's GUI client.
|
long |
getVersion() |
boolean |
isSignatureValid()
Returns true if the digital signature attached to the message verifies.
|
protected void |
parse() |
void |
setCancel(long cancel) |
void |
setComment(java.lang.String comment) |
void |
setExpiration(java.util.Date expiration) |
void |
setId(long id) |
void |
setMaxVer(long maxVer) |
void |
setMinVer(long minVer) |
void |
setPriority(long priority) |
void |
setRelayUntil(java.util.Date relayUntil) |
void |
setReserved(java.lang.String reserved) |
void |
setStatusBar(java.lang.String statusBar) |
java.lang.String |
toString() |
adjustLength, bitcoinSerialize, bitcoinSerialize, bitcoinSerializeToStream, getHash, getMessageSize, getParams, hasMoreBytes, isCached, isRecached, readByte, readByteArray, readBytes, readHash, readInt64, readStr, readUint32, readUint64, readVarInt, readVarInt, setSerializer, unCache, unsafeBitcoinSerialize
public AlertMessage(NetworkParameters params, byte[] payloadBytes) throws ProtocolException
ProtocolException
public java.lang.String toString()
toString
in class java.lang.Object
protected void parse() throws ProtocolException
parse
in class Message
ProtocolException
public boolean isSignatureValid()
public java.util.Date getRelayUntil()
public void setRelayUntil(java.util.Date relayUntil)
public java.util.Date getExpiration()
public void setExpiration(java.util.Date expiration)
public long getId()
public void setId(long id)
public long getCancel()
public void setCancel(long cancel)
public long getMinVer()
public void setMinVer(long minVer)
public long getMaxVer()
public void setMaxVer(long maxVer)
public long getPriority()
public void setPriority(long priority)
public java.lang.String getComment()
public void setComment(java.lang.String comment)
public java.lang.String getStatusBar()
public void setStatusBar(java.lang.String statusBar)
public java.lang.String getReserved()
public void setReserved(java.lang.String reserved)
public long getVersion()