mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-12 18:25:51 +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")) {
|
||||
return new HeadersMessage(params, payloadBytes);
|
||||
} else if (command.equals("alert")) {
|
||||
log.info("alert payload " + Utils.bytesToHexString(payloadBytes));
|
||||
return new AlertMessage(params, payloadBytes);
|
||||
} else {
|
||||
log.warn("No support for deserializing message with name {}", command);
|
||||
|
@ -209,6 +209,8 @@ public class Peer {
|
||||
// properly explore the network.
|
||||
} else if (m instanceof HeadersMessage) {
|
||||
processHeaders((HeadersMessage) m);
|
||||
} else if (m instanceof AlertMessage) {
|
||||
processAlert((AlertMessage)m);
|
||||
} else {
|
||||
// TODO: Handle the other messages we can receive.
|
||||
log.warn("Received unhandled message: {}", m);
|
||||
@ -234,6 +236,14 @@ public class Peer {
|
||||
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 {
|
||||
// Runs in network loop thread for this peer.
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user