mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-13 02:35:52 +00:00
Print out alert messages to the log.
This commit is contained in:
parent
0e198e68e8
commit
68424281c5
@ -335,7 +335,6 @@ public class BitcoinSerializer {
|
|||||||
} else if (command.equals("headers")) {
|
} else if (command.equals("headers")) {
|
||||||
return new HeadersMessage(params, payloadBytes);
|
return new HeadersMessage(params, payloadBytes);
|
||||||
} else if (command.equals("alert")) {
|
} else if (command.equals("alert")) {
|
||||||
log.info("alert payload " + Utils.bytesToHexString(payloadBytes));
|
|
||||||
return new AlertMessage(params, payloadBytes);
|
return new AlertMessage(params, payloadBytes);
|
||||||
} else {
|
} else {
|
||||||
log.warn("No support for deserializing message with name {}", command);
|
log.warn("No support for deserializing message with name {}", command);
|
||||||
|
@ -209,6 +209,8 @@ public class Peer {
|
|||||||
// properly explore the network.
|
// properly explore the network.
|
||||||
} else if (m instanceof HeadersMessage) {
|
} else if (m instanceof HeadersMessage) {
|
||||||
processHeaders((HeadersMessage) m);
|
processHeaders((HeadersMessage) m);
|
||||||
|
} else if (m instanceof AlertMessage) {
|
||||||
|
processAlert((AlertMessage)m);
|
||||||
} else {
|
} else {
|
||||||
// TODO: Handle the other messages we can receive.
|
// TODO: Handle the other messages we can receive.
|
||||||
log.warn("Received unhandled message: {}", m);
|
log.warn("Received unhandled message: {}", m);
|
||||||
@ -234,6 +236,14 @@ public class Peer {
|
|||||||
disconnect();
|
disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void processAlert(AlertMessage m) {
|
||||||
|
if (m.isSignatureValid()) {
|
||||||
|
log.info("Received alert from peer {}: {}", toString(), m.getStatusBar());
|
||||||
|
} else {
|
||||||
|
log.warn("Received alert with invalid signature from peer {}: {}", toString(), m.getStatusBar());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void processHeaders(HeadersMessage m) throws IOException, ProtocolException {
|
private void processHeaders(HeadersMessage m) throws IOException, ProtocolException {
|
||||||
// Runs in network loop thread for this peer.
|
// Runs in network loop thread for this peer.
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user