|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.bitcoin.core.Message
com.google.bitcoin.core.AlertMessage
public class AlertMessage
Alerts are signed messages that are broadcast on the peer-to-peer network if they match a hard-coded signing key. The private keys are held by a small group of core Bitcoin developers, and alerts may be broadcast in the event of an available upgrade or a serious network problem. Alerts have an expiration time, data that specifies what set of software versions it matches and the ability to cancel them by broadcasting another type of alert.
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().
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.google.bitcoin.core.Message |
|---|
Message.LazyParseException |
| Field Summary |
|---|
| Fields inherited from class com.google.bitcoin.core.Message |
|---|
bytes, checksum, cursor, length, MAX_SIZE, offset, params, parsed, parseLazy, parseRetain, protocolVersion, recached, UNKNOWN_LENGTH |
| Constructor Summary | |
|---|---|
AlertMessage(NetworkParameters params,
byte[] payloadBytes)
|
|
| Method Summary | |
|---|---|
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. |
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()
|
| Methods inherited from class com.google.bitcoin.core.Message |
|---|
adjustLength, bitcoinSerialize, bitcoinSerialize, ensureParsed, getHash, getMessageSize, getParams, isCached, isParsed, isRecached, maybeParse, unCache, unsafeBitcoinSerialize |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AlertMessage(NetworkParameters params,
byte[] payloadBytes)
throws ProtocolException
ProtocolException| Method Detail |
|---|
public String toString()
toString in class Objectpublic boolean isSignatureValid()
protected void parseLite()
throws ProtocolException
Message
parseLite in class MessageProtocolExceptionpublic 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()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||