Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F10615195
alert.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
alert.h
View Options
// Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef _BITCOINALERT_H_
#define _BITCOINALERT_H_ 1
#include
<set>
#include
<string>
#include
"uint256.h"
#include
"util.h"
class
CNode
;
/** Alerts are for notifying old versions if they become too obsolete and
* need to upgrade. The message is displayed in the status bar.
* Alert messages are broadcast as a vector of signed data. Unserializing may
* not read the entire buffer if the alert is for a newer version, but older
* versions can still relay the original data.
*/
class
CUnsignedAlert
{
public
:
int
nVersion
;
int64
nRelayUntil
;
// when newer nodes stop relaying to newer nodes
int64
nExpiration
;
int
nID
;
int
nCancel
;
std
::
set
<
int
>
setCancel
;
int
nMinVer
;
// lowest version inclusive
int
nMaxVer
;
// highest version inclusive
std
::
set
<
std
::
string
>
setSubVer
;
// empty matches all
int
nPriority
;
// Actions
std
::
string
strComment
;
std
::
string
strStatusBar
;
std
::
string
strReserved
;
IMPLEMENT_SERIALIZE
(
READWRITE
(
this
->
nVersion
);
nVersion
=
this
->
nVersion
;
READWRITE
(
nRelayUntil
);
READWRITE
(
nExpiration
);
READWRITE
(
nID
);
READWRITE
(
nCancel
);
READWRITE
(
setCancel
);
READWRITE
(
nMinVer
);
READWRITE
(
nMaxVer
);
READWRITE
(
setSubVer
);
READWRITE
(
nPriority
);
READWRITE
(
strComment
);
READWRITE
(
strStatusBar
);
READWRITE
(
strReserved
);
)
void
SetNull
();
std
::
string
ToString
()
const
;
void
print
()
const
;
};
/** An alert is a combination of a serialized CUnsignedAlert and a signature. */
class
CAlert
:
public
CUnsignedAlert
{
public
:
std
::
vector
<
unsigned
char
>
vchMsg
;
std
::
vector
<
unsigned
char
>
vchSig
;
CAlert
()
{
SetNull
();
}
IMPLEMENT_SERIALIZE
(
READWRITE
(
vchMsg
);
READWRITE
(
vchSig
);
)
void
SetNull
();
bool
IsNull
()
const
;
uint256
GetHash
()
const
;
bool
IsInEffect
()
const
;
bool
Cancels
(
const
CAlert
&
alert
)
const
;
bool
AppliesTo
(
int
nVersion
,
std
::
string
strSubVerIn
)
const
;
bool
AppliesToMe
()
const
;
bool
RelayTo
(
CNode
*
pnode
)
const
;
bool
CheckSignature
()
const
;
bool
ProcessAlert
();
/*
* Get copy of (active) alert object by hash. Returns a null alert if it is not found.
*/
static
CAlert
getAlertByHash
(
const
uint256
&
hash
);
};
#endif
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Sat, Nov 23, 10:01 (1 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4513276
Default Alt Text
alert.h (2 KB)
Attached To
rSTAGING Bitcoin ABC staging
Event Timeline
Log In to Comment