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()
.
Message.LazyParseException
checksum, cursor, length, MAX_SIZE, offset, params, parsed, parseLazy, parseRetain, payload, protocolVersion, recached, 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.
|
String |
getComment()
This field is unused.
|
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.
|
Date |
getRelayUntil()
The time at which the alert should stop being broadcast across the network.
|
String |
getReserved()
This field is never used.
|
String |
getStatusBar()
A string that is intended to display in the status bar of the official GUI client.
|
long |
getVersion() |
boolean |
isSignatureValid()
Returns true if the digital signature attached to the message verifies.
|
protected void |
parseLite()
Perform the most minimal parse possible to calculate the length of the message payload.
|
void |
setCancel(long cancel) |
void |
setComment(String comment) |
void |
setExpiration(Date expiration) |
void |
setId(long id) |
void |
setMaxVer(long maxVer) |
void |
setMinVer(long minVer) |
void |
setPriority(long priority) |
void |
setRelayUntil(Date relayUntil) |
void |
setReserved(String reserved) |
void |
setStatusBar(String statusBar) |
String |
toString() |
adjustLength, bitcoinSerialize, bitcoinSerialize, ensureParsed, getHash, getMessageSize, getParams, isCached, isParsed, isRecached, maybeParse, unCache, unsafeBitcoinSerialize
public AlertMessage(NetworkParameters params, byte[] payloadBytes) throws ProtocolException
ProtocolException
public boolean isSignatureValid()
protected void parseLite() throws ProtocolException
Message
parseLite
in class Message
ProtocolException
public Date getRelayUntil()
public void setRelayUntil(Date relayUntil)
public Date getExpiration()
public void setExpiration(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 String getComment()
public void setComment(String comment)
public String getStatusBar()
public void setStatusBar(String statusBar)
public String getReserved()
public void setReserved(String reserved)
public long getVersion()
Copyright © 2014. All rights reserved.